mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-02-08 23:20:03 +00:00
Ensure that savers invoke the callback
This commit is contained in:
parent
e47852cb14
commit
ab41462af3
@ -38,6 +38,8 @@ DownloadSaver.prototype.save = function(text,method,callback) {
|
|||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
|
// Callback that we succeeded
|
||||||
|
callback(null);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -33,14 +33,16 @@ FSOSaver.prototype.save = function(text,method,callback) {
|
|||||||
pathname = pathname.substr(1);
|
pathname = pathname.substr(1);
|
||||||
// reconstruct UNC path
|
// reconstruct UNC path
|
||||||
pathname = "\\\\" + document.location.hostname + pathname;
|
pathname = "\\\\" + document.location.hostname + pathname;
|
||||||
} else return false;
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Save the file (as UTF-16)
|
// Save the file (as UTF-16)
|
||||||
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
var fso = new ActiveXObject("Scripting.FileSystemObject");
|
||||||
var file = fso.OpenTextFile(pathname,2,-1,-1);
|
var file = fso.OpenTextFile(pathname,2,-1,-1);
|
||||||
|
|
||||||
file.Write(text);
|
file.Write(text);
|
||||||
file.Close();
|
file.Close();
|
||||||
|
// Callback that we succeeded
|
||||||
|
callback(null);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@ ManualDownloadSaver.prototype.save = function(text,method,callback) {
|
|||||||
$tw.modal.display(downloadInstructionsTitle,{
|
$tw.modal.display(downloadInstructionsTitle,{
|
||||||
downloadLink: "data:text/html," + encodeURIComponent(text)
|
downloadLink: "data:text/html," + encodeURIComponent(text)
|
||||||
});
|
});
|
||||||
|
// Callback that we succeeded
|
||||||
|
callback(null);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@ MsDownloadSaver.prototype.save = function(text,method,callback) {
|
|||||||
// Set up the link
|
// Set up the link
|
||||||
var blob = new Blob([text], {type: "text/html"});
|
var blob = new Blob([text], {type: "text/html"});
|
||||||
window.navigator.msSaveBlob(blob,filename);
|
window.navigator.msSaveBlob(blob,filename);
|
||||||
|
// Callback that we succeeded
|
||||||
|
callback(null);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,9 +35,10 @@ TiddlyIESaver.prototype.save = function(text,method,callback) {
|
|||||||
// reconstruct UNC path
|
// reconstruct UNC path
|
||||||
pathname = "\\\\" + document.location.hostname + pathname;
|
pathname = "\\\\" + document.location.hostname + pathname;
|
||||||
} else return false;
|
} else return false;
|
||||||
|
|
||||||
// Prompt the user to save the file
|
// Prompt the user to save the file
|
||||||
window.TiddlyIE.save(pathname, text);
|
window.TiddlyIE.save(pathname, text);
|
||||||
|
// Callback that we succeeded
|
||||||
|
callback(null);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user