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

jsonset: add support for assigning JSON strings

This commit is contained in:
jeremy@jermolene.com
2023-04-05 12:26:40 +01:00
parent 2e922976c4
commit a71150ae81
3 changed files with 9 additions and 2 deletions

View File

@@ -75,7 +75,7 @@ exports["jsonset"] = function(source,operator,options) {
value = operator.operands[operator.operands.length - 1],
results = [];
if(operator.operands.length === 1 && operator.operands[0] === "") {
value = undefined;
value = undefined; // Prevents the value from being assigned
}
switch(type) {
case "string":
@@ -99,6 +99,9 @@ exports["jsonset"] = function(source,operator,options) {
indexes = operator.operands;
value = null;
break;
case "json":
value = $tw.utils.parseJSONSafe(value,function() {return undefined;});
break;
default:
// Use value unchanged
break;