Skip to content

Commit

Permalink
minor refactoring of saveChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
YakovL committed Mar 8, 2020
1 parent e32289e commit 0c9ccc1
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions js/Saving.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,31 +149,29 @@ function saveChanges(onlyIfDirty, tiddlers)
clearMessage();
var t0 = new Date();
var msg = config.messages;
//# Get the URL of the document
var originalPath = document.location.toString();
//# Check we can save this file
if(!window.allowSave()) {
alert(msg.notFileUrlError);
if(store.tiddlerExists(msg.saveInstructions))
story.displayTiddler(null, msg.saveInstructions);
return;
}
// Load the original file
var originalPath = document.location.toString();
var localPath = getLocalPath(originalPath);
//# Load the original file
var original = loadOriginal(localPath);
if(original == null) {
alert(msg.cantSaveError);
if(store.tiddlerExists(msg.saveInstructions))
story.displayTiddler(null, msg.saveInstructions);
return;
}
//# Locate the storeArea div's
// Locate the storeArea div's
var posDiv = locateStoreArea(original);
if(!posDiv) {
alert(msg.invalidFileError.format([localPath]));
return;
}
var co = config.options; //# abbreviation
var co = config.options; // abbreviation
config.saveByDownload = false;
config.saveByManualDownload = false;
saveMain(localPath, original, posDiv);
Expand Down

0 comments on commit 0c9ccc1

Please sign in to comment.