|
|
@ -434,7 +434,11 @@ |
|
|
|
xhr.send(formData); |
|
|
|
xhr.send(formData); |
|
|
|
xhr.onreadystatechange = function(){ |
|
|
|
xhr.onreadystatechange = function(){ |
|
|
|
if(xhr.readyState == 4){ |
|
|
|
if(xhr.readyState == 4){ |
|
|
|
processResponse(xhr.responseText, file.identifier); |
|
|
|
if (xhr.status == 200){ |
|
|
|
|
|
|
|
processResponse(xhr.responseText, file.identifier); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
processFailure(file.identifier); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -445,6 +449,10 @@ |
|
|
|
textarea.value = textarea.value.replace(getMarkdownRegex(identifier), "["+ description +"]("+response.url+")"); |
|
|
|
textarea.value = textarea.value.replace(getMarkdownRegex(identifier), "["+ description +"]("+response.url+")"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function processFailure(identifier){ |
|
|
|
|
|
|
|
textarea.value = textarea.value.replace(getMarkdownRegex(identifier), ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function getMarkdownRegex(identifier){ |
|
|
|
function getMarkdownRegex(identifier){ |
|
|
|
return new RegExp('\\[' + identifier + '\\]\\(.*?\\)'); |
|
|
|
return new RegExp('\\[' + identifier + '\\]\\(.*?\\)'); |
|
|
|
} |
|
|
|
} |
|
|
|