mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-16 14:51:24 +00:00
TiddlyFox now saves with TiddlyWiki5 as well as TiddlyWiki Classic
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
/*\
|
||||
title: $:/core/modules/savers/tiddlyfox.js
|
||||
type: application/javascript
|
||||
module-type: saver
|
||||
|
||||
Handles saving changes via the TiddlyFox file extension
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false, netscape: false, Components: false */
|
||||
"use strict";
|
||||
|
||||
var TiddlyFoxSaver = function(wiki) {
|
||||
};
|
||||
|
||||
TiddlyFoxSaver.prototype.save = function(text) {
|
||||
var messageBox = document.getElementById("tiddlyfox-message-box");
|
||||
console.log("messageBox",messageBox);
|
||||
if(messageBox) {
|
||||
// Create the message element and put it in the message box
|
||||
var message = document.createElement("div");
|
||||
message.setAttribute("tiddlyfox-path",document.location.pathname);
|
||||
message.setAttribute("tiddlyfox-content",text);
|
||||
messageBox.appendChild(message);
|
||||
// Create and dispatch the custom event to the extension
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("tiddlyfox-save-file",true,false);
|
||||
message.dispatchEvent(event);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Information about this saver
|
||||
*/
|
||||
TiddlyFoxSaver.prototype.info = {
|
||||
name: "tiddlyfox",
|
||||
priority: 1500
|
||||
};
|
||||
|
||||
/*
|
||||
Static method that returns true if this saver is capable of working
|
||||
*/
|
||||
exports.canSave = function(wiki) {
|
||||
return (window.location.protocol === "file:");
|
||||
};
|
||||
|
||||
/*
|
||||
Create an instance of this saver
|
||||
*/
|
||||
exports.create = function(wiki) {
|
||||
return new TiddlyFoxSaver(wiki);
|
||||
};
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user