mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Enhance TiddlyFox saver to display a notification on success
This commit is contained in:
parent
24db38c06b
commit
e501c0ec2a
3
core/messages/Saved.tid
Normal file
3
core/messages/Saved.tid
Normal file
@ -0,0 +1,3 @@
|
||||
title: $:/messages/Saved
|
||||
|
||||
Saved wiki
|
@ -15,7 +15,7 @@ Handles saving changes via the TiddlyFox file extension
|
||||
var TiddlyFoxSaver = function(wiki) {
|
||||
};
|
||||
|
||||
TiddlyFoxSaver.prototype.save = function(text) {
|
||||
TiddlyFoxSaver.prototype.save = function(text,callback) {
|
||||
var messageBox = document.getElementById("tiddlyfox-message-box");
|
||||
if(messageBox) {
|
||||
// Create the message element and put it in the message box
|
||||
@ -23,6 +23,10 @@ TiddlyFoxSaver.prototype.save = function(text) {
|
||||
message.setAttribute("data-tiddlyfox-path",decodeURIComponent(document.location.pathname));
|
||||
message.setAttribute("data-tiddlyfox-content",text);
|
||||
messageBox.appendChild(message);
|
||||
// Add an event handler for when the file has been saved
|
||||
message.addEventListener("tiddlyfox-have-saved-file",function(event) {
|
||||
callback(null);
|
||||
}, false);
|
||||
// Create and dispatch the custom event to the extension
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("tiddlyfox-save-file",true,false);
|
||||
|
@ -622,7 +622,9 @@ exports.saveWiki = function(options) {
|
||||
var template = options.template || "$:/core/templates/tiddlywiki5.template.html",
|
||||
downloadType = options.downloadType || "text/plain";
|
||||
var text = this.renderTiddler(downloadType,template);
|
||||
this.callSaver("save",text);
|
||||
this.callSaver("save",text,function(err) {
|
||||
$tw.notifier.display("$:/messages/Saved");
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user