diff --git a/editions/clientserver/tiddlywiki.info b/editions/clientserver/tiddlywiki.info index fb33cbf44..6d60ee302 100644 --- a/editions/clientserver/tiddlywiki.info +++ b/editions/clientserver/tiddlywiki.info @@ -1,6 +1,7 @@ { "plugins": [ - "tiddlywiki/tiddlyweb" + "tiddlywiki/tiddlyweb", + "tiddlywiki/filesystem" ], "parentWiki": "../tw5.com" } \ No newline at end of file diff --git a/plugins/tiddlywiki/filesystem/filesystemadaptor.js b/plugins/tiddlywiki/filesystem/filesystemadaptor.js new file mode 100644 index 000000000..cc391193a --- /dev/null +++ b/plugins/tiddlywiki/filesystem/filesystemadaptor.js @@ -0,0 +1,54 @@ +/*\ +title: $:/plugins/tiddlywiki/filesystem/filesystemadaptor.js +type: application/javascript +module-type: syncadaptor + +A sync adaptor module for synchronising with the local filesystem via node.js APIs + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +// Get a reference to the file system +var fs = !$tw.browser ? require("fs") : null; + +function FileSystemAdaptor(syncer) { + this.syncer = syncer; +} + +FileSystemAdaptor.prototype.getTiddlerInfo = function(tiddler) { + return {}; +}; + +/* +Save a tiddler and invoke the callback with (err,adaptorInfo,revision) +*/ +FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) { +console.log("FileSystem: Saving",tiddler.fields); + callback(null,{},0); +}; + +/* +Load a tiddler and invoke the callback with (err,tiddlerFields) +*/ +FileSystemAdaptor.prototype.loadTiddler = function(title,callback) { +console.log("FileSystem: Loading",title); + callback(null,{title: title, text: "Fake tiddler: " + title}); +}; + +/* +Delete a tiddler and invoke the callback with (err) +*/ +FileSystemAdaptor.prototype.deleteTiddler = function(title,callback) { +console.log("FileSystem: Deleting",title); + callback(null); +}; + +if(fs) { + exports.adaptorClass = FileSystemAdaptor; +} + +})(); diff --git a/plugins/tiddlywiki/filesystem/plugin.info b/plugins/tiddlywiki/filesystem/plugin.info new file mode 100644 index 000000000..0109abd1d --- /dev/null +++ b/plugins/tiddlywiki/filesystem/plugin.info @@ -0,0 +1,7 @@ +{ + "title": "$:/plugins/tiddlywiki/filesystem", + "description": "File system synchronisation", + "author": "JeremyRuston", + "version": "0.0.0", + "coreVersion": ">=5.0.0" +}