Fix typo
This commit is contained in:
parent
42768ca166
commit
8f4e15666a
|
@ -414,7 +414,11 @@ $tw.utils.parseJSONSafe = function(text,defaultJSON) {
|
|||
try {
|
||||
return JSON.parse(text);
|
||||
} 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) {
|
||||
var incoming,
|
||||
results = [];
|
||||
incoming = $tw.utils.parseJSONSafe(text,[{
|
||||
title: "JSON error: " + e,
|
||||
text: ""
|
||||
}]);
|
||||
var results = [],
|
||||
incoming = $tw.utils.parseJSONSafe(text,function(err) {
|
||||
return [{
|
||||
title: "JSON error: " + err,
|
||||
text: ""
|
||||
}];
|
||||
});
|
||||
if(!$tw.utils.isArray(incoming)) {
|
||||
incoming = [incoming];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue