2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-06-28 05:31:06 -06:00

Changed function name escapeURI to escapedPromptURL and option escapeURLs to option escapePromptURLs

This commit is contained in:
Zignature 2022-01-15 23:34:05 +01:00
parent 33489ab616
commit c174b6f149

View File

@ -849,9 +849,9 @@ function drawLink(editor) {
return false;
}
if (options.escapeURLs) {
if (options.escapePromptURLs) {
url = encodeURI(url);
if (/[()]/.test(url)) url = escapeURI(url);
if (/[()]/.test(url)) url = escapePromptURL(url);
}
}
_replaceSelection(cm, stat.link, options.insertTexts.link, url);
@ -871,9 +871,9 @@ function drawImage(editor) {
return false;
}
if (options.escapeURLs) {
if (options.escapePromptURLs) {
url = encodeURI(url);
if (/[()]/.test(url)) url = escapeURI(url);
if (/[()]/.test(url)) url = escapePromptURL(url);
}
}
_replaceSelection(cm, stat.image, options.insertTexts.image, url);
@ -883,7 +883,7 @@ function drawImage(editor) {
* Escape URLs to prevent breaking up rendered Markdown links
* @param url {string} The url of the link or image
*/
function escapeURI(url) {
function escapePromptURL(url) {
url = url.replace(/\(/g,'\\(').replace(/\)/g,'\\)');
return url;