diff --git a/dialogs/simplelink.js b/dialogs/simplelink.js index 796ca3f..adaf227 100644 --- a/dialogs/simplelink.js +++ b/dialogs/simplelink.js @@ -1,4 +1,5 @@ CKEDITOR.dialog.add("simplelinkDialog", function(editor) { + var isExternalURL = /^((http|https):\/\/|mailto:)/; return { allowedContent: "a[href,target]", title: "Insert Link", @@ -15,7 +16,6 @@ validate: CKEDITOR.dialog.validate.notEmpty( "url cannot be empty." ), setup: function( element ) { var href = element.getAttribute("href"); - var isExternalURL = /^(http|https):\/\//; if(href) { if(!isExternalURL.test(href)) { href = "http://" + href; @@ -25,12 +25,12 @@ }, commit: function(element) { var href = this.getValue(); - var isExternalURL = /^(http|https):\/\//; if(href) { if(!isExternalURL.test(href)) { href = "http://" + href; } element.setAttribute("href", href); + element.setAttribute("data-cke-saved-href", href); if(!element.getText()) { element.setText(this.getValue()); }