]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/tinymce/themes/advanced/js/link.js
Wordpress 3.2
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / themes / advanced / js / link.js
index 73b9f597e21edd0af2e17810947ab3ad3185370c..e67d868a2b4bde9250079bfca077ffefc2f3fc7b 100644 (file)
@@ -31,7 +31,7 @@ var LinkDialog = {
        },
 
        update : function() {
-               var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;
+               var f = document.forms[0], ed = tinyMCEPopup.editor, e, b, href = f.href.value.replace(/ /g, '%20');
 
                tinyMCEPopup.restoreSelection();
                e = ed.dom.getParent(ed.selection.getNode(), 'A');
@@ -39,7 +39,6 @@ var LinkDialog = {
                // Remove element if there is no href
                if (!f.href.value) {
                        if (e) {
-                               tinyMCEPopup.execCommand("mceBeginUndoLevel");
                                b = ed.selection.getBookmark();
                                ed.dom.remove(e, 1);
                                ed.selection.moveToBookmark(b);
@@ -49,19 +48,17 @@ var LinkDialog = {
                        }
                }
 
-               tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
                // Create new anchor elements
                if (e == null) {
                        ed.getDoc().execCommand("unlink", false, null);
-                       tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
+                       tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
 
                        tinymce.each(ed.dom.select("a"), function(n) {
                                if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
                                        e = n;
 
                                        ed.dom.setAttribs(e, {
-                                               href : f.href.value,
+                                               href : href,
                                                title : f.linktitle.value,
                                                target : f.target_list ? getSelectValue(f, "target_list") : null,
                                                'class' : f.class_list ? getSelectValue(f, "class_list") : null
@@ -70,7 +67,7 @@ var LinkDialog = {
                        });
                } else {
                        ed.dom.setAttribs(e, {
-                               href : f.href.value,
+                               href : href,
                                title : f.linktitle.value,
                                target : f.target_list ? getSelectValue(f, "target_list") : null,
                                'class' : f.class_list ? getSelectValue(f, "class_list") : null