mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 20:10:03 +00:00
Fix JSON deserialiser to allow all fields
Previously we were filtering to a small set of known fields (which was implemented at the beginning of TW5 as part of the build process for TW2).
This commit is contained in:
parent
4dec771c20
commit
4bf6fe7fe9
@ -72,21 +72,21 @@ exports["application/x-tiddler-html-div"] = function(text,fields) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports["application/json"] = function(text,fields) {
|
exports["application/json"] = function(text,fields) {
|
||||||
var tiddlers = JSON.parse(text),
|
var incoming = JSON.parse(text),
|
||||||
result = [],
|
results = [];
|
||||||
getKnownFields = function(tid) {
|
if($tw.utils.isArray(incoming)) {
|
||||||
var fields = {};
|
for(var t=0; t<incoming.length; t++) {
|
||||||
"title text created creator modified modifier type tags".split(" ").forEach(function(value) {
|
var incomingFields = incoming[t],
|
||||||
if(tid[value] !== null) {
|
fields = {};
|
||||||
fields[value] = tid[value];
|
for(var f in incomingFields) {
|
||||||
|
if(typeof incomingFields[f] === "string") {
|
||||||
|
fields[f] = incomingFields[f];
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
return fields;
|
results.push(fields);
|
||||||
};
|
}
|
||||||
for(var t=0; t<tiddlers.length; t++) {
|
|
||||||
result.push(getKnownFields(tiddlers[t]));
|
|
||||||
}
|
}
|
||||||
return result;
|
return results;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user