1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-26 07:13:15 +00:00

Ensure that savers invoke the callback

This commit is contained in:
Jermolene 2014-08-27 09:59:01 +01:00
parent e47852cb14
commit ab41462af3
5 changed files with 13 additions and 4 deletions

View File

@ -38,6 +38,8 @@ DownloadSaver.prototype.save = function(text,method,callback) {
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
// Callback that we succeeded
callback(null);
return true;
};

View File

@ -33,14 +33,16 @@ FSOSaver.prototype.save = function(text,method,callback) {
pathname = pathname.substr(1);
// reconstruct UNC path
pathname = "\\\\" + document.location.hostname + pathname;
} else return false;
} else {
return false;
}
// Save the file (as UTF-16)
var fso = new ActiveXObject("Scripting.FileSystemObject");
var file = fso.OpenTextFile(pathname,2,-1,-1);
file.Write(text);
file.Close();
// Callback that we succeeded
callback(null);
return true;
};

View File

@ -25,6 +25,8 @@ ManualDownloadSaver.prototype.save = function(text,method,callback) {
$tw.modal.display(downloadInstructionsTitle,{
downloadLink: "data:text/html," + encodeURIComponent(text)
});
// Callback that we succeeded
callback(null);
return true;
};

View File

@ -28,6 +28,8 @@ MsDownloadSaver.prototype.save = function(text,method,callback) {
// Set up the link
var blob = new Blob([text], {type: "text/html"});
window.navigator.msSaveBlob(blob,filename);
// Callback that we succeeded
callback(null);
return true;
};

View File

@ -35,9 +35,10 @@ TiddlyIESaver.prototype.save = function(text,method,callback) {
// reconstruct UNC path
pathname = "\\\\" + document.location.hostname + pathname;
} else return false;
// Prompt the user to save the file
window.TiddlyIE.save(pathname, text);
// Callback that we succeeded
callback(null);
return true;
} else {
return false;