kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Ensure that savers invoke the callback
rodzic
e47852cb14
commit
ab41462af3
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Ładowanie…
Reference in New Issue