mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-07-30 05:14:28 -06:00
catch json-parse error
This commit is contained in:
parent
93f0d7a1ce
commit
1b50ce6015
@ -679,9 +679,13 @@ function uploadImage(editor) {
|
||||
xmlhttp.send(formData);
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
|
||||
var res = JSON.parse(xmlhttp.responseText);
|
||||
if(res.url) {
|
||||
editor.codemirror.replaceSelection("");
|
||||
try {
|
||||
var res = JSON.parse(xmlhttp.responseText);
|
||||
if(res.url) {
|
||||
editor.codemirror.replaceSelection("");
|
||||
}
|
||||
} catch (e) {
|
||||
editor.codemirror.replaceSelection("![]()");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user