1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-12-02 23:08:06 +00:00

Add support for JSON files containing a single tiddler

At the moment, we support JSON files containing an array of tiddlers.
With this change the core will import files containing a single
tiddler. Also adding templates for saving individual tiddlers in JSON
format
This commit is contained in:
Jermolene
2017-03-17 14:19:43 +00:00
parent d65fd771e7
commit 779e62a30f
5 changed files with 72 additions and 11 deletions

View File

@@ -1320,8 +1320,8 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/html","tiddlerdeserializer",{
});
$tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
"application/json": function(text,fields) {
var tiddlers = JSON.parse(text);
return tiddlers;
var data = JSON.parse(text);
return $tw.utils.isArray(data) ? data : [data];
}
});