Fix typo
This commit is contained in:
parent
42768ca166
commit
8f4e15666a
|
@ -414,7 +414,11 @@ $tw.utils.parseJSONSafe = function(text,defaultJSON) {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(text);
|
return JSON.parse(text);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
return defaultJSON || {};
|
if(typeof defaultJSON === "function") {
|
||||||
|
return defaultJSON(e);
|
||||||
|
} else {
|
||||||
|
return defaultJSON || {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,13 @@ exports["application/x-tiddler-html-div"] = function(text,fields) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports["application/json"] = function(text,fields) {
|
exports["application/json"] = function(text,fields) {
|
||||||
var incoming,
|
var results = [],
|
||||||
results = [];
|
incoming = $tw.utils.parseJSONSafe(text,function(err) {
|
||||||
incoming = $tw.utils.parseJSONSafe(text,[{
|
return [{
|
||||||
title: "JSON error: " + e,
|
title: "JSON error: " + err,
|
||||||
text: ""
|
text: ""
|
||||||
}]);
|
}];
|
||||||
|
});
|
||||||
if(!$tw.utils.isArray(incoming)) {
|
if(!$tw.utils.isArray(incoming)) {
|
||||||
incoming = [incoming];
|
incoming = [incoming];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue