]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/wplink.js
Wordpress 3.7
[autoinstalls/wordpress.git] / wp-includes / js / wplink.js
index 232fd4e2f93f2d4bab79868ab5994c77c8edaa67..1e20215531feaf6694e7cc0eff5c0aa36d6afa54 100644 (file)
@@ -121,8 +121,6 @@ var wpLink;
                        } else {
                                wpLink.setDefaultValues();
                        }
-
-                       tinyMCEPopup.storeSelection();
                },
 
                close : function() {
@@ -226,7 +224,6 @@ var wpLink;
                        // If the values are empty, unlink and return
                        if ( ! attrs.href || attrs.href == 'http://' ) {
                                if ( e ) {
-                                       tinyMCEPopup.execCommand("mceBeginUndoLevel");
                                        b = ed.selection.getBookmark();
                                        ed.dom.remove(e, 1);
                                        ed.selection.moveToBookmark(b);
@@ -236,8 +233,6 @@ var wpLink;
                                return;
                        }
 
-                       tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
                        if (e == null) {
                                ed.getDoc().execCommand("unlink", false, null);
                                tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
@@ -252,7 +247,7 @@ var wpLink;
                                // Sometimes WebKit lets a user create a link where
                                // they shouldn't be able to. In this case, CreateLink
                                // injects "#mce_temp_url#" into their content. Fix it.
-                               if ( $(e).text() == '#mce_temp_url#' ) {
+                               if ( tinymce.isWebKit && $(e).text() == '#mce_temp_url#' ) {
                                        ed.dom.remove(e);
                                        e = null;
                                }
@@ -260,16 +255,16 @@ var wpLink;
                                ed.dom.setAttribs(e, attrs);
                        }
 
-                       // Don't move caret if selection was image
+                       // Move the caret if selection was not an image.
                        if ( e && (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') ) {
-                               ed.focus();
                                ed.selection.select(e);
                                ed.selection.collapse(0);
                                tinyMCEPopup.storeSelection();
                        }
 
-                       tinyMCEPopup.execCommand("mceEndUndoLevel");
+                       ed.execCommand("mceEndUndoLevel");
                        wpLink.close();
+                       ed.focus();
                },
 
                updateFields : function( e, li, originalEvent ) {