Skip to content

Commit

Permalink
refactor: make saveMain even more straight-forward
Browse files Browse the repository at this point in the history
  • Loading branch information
YakovL committed May 11, 2023
1 parent e2183ae commit 4512d53
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions js/Saving.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,15 @@ function saveMain(localPath, original, posDiv)
{
try {
var revised = updateOriginal(original, posDiv, localPath);
var save = saveFile(localPath, revised);
if(!save) {
var saved = saveFile(localPath, revised);
if(!saved) {
tw.io.onSaveMainFail();
return;
} else {
tw.io.onSaveMainSuccess(config.saveByDownload ? getDataURI(revised) : "file://" + localPath, revised, original);
}
} catch (ex) {
tw.io.onSaveMainFail(ex);
}

tw.io.onSaveMainSuccess(config.saveByDownload ? getDataURI(revised) : "file://" + localPath, revised, original);
}

//# savedHtml, original are passed for additional hackability
Expand Down

0 comments on commit 4512d53

Please sign in to comment.