]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/js/wplink.dev.js
WordPress 3.4
[autoinstalls/wordpress.git] / wp-includes / js / wplink.dev.js
index 24403d3136bcfceb728a0db7600c0f58125571a8..d0c4b9a0a0a22b029ad78a601c5a3300bfc6d7c8 100644 (file)
@@ -160,7 +160,7 @@ var wpLink;
                },
 
                htmlUpdate : function() {
-                       var attrs, html, start, end, cursor,
+                       var attrs, html, begin, end, cursor,
                                textarea = wpLink.textarea;
 
                        if ( ! textarea )
@@ -183,35 +183,34 @@ var wpLink;
                        html += '>';
 
                        // Insert HTML
-                       // W3C
-                       if ( typeof textarea.selectionStart !== 'undefined' ) {
-                               start       = textarea.selectionStart;
+                       if ( document.selection && wpLink.range ) {
+                               // IE
+                               // Note: If no text is selected, IE will not place the cursor
+                               //       inside the closing tag.
+                               textarea.focus();
+                               wpLink.range.text = html + wpLink.range.text + '</a>';
+                               wpLink.range.moveToBookmark( wpLink.range.getBookmark() );
+                               wpLink.range.select();
+
+                               wpLink.range = null;
+                       } else if ( typeof textarea.selectionStart !== 'undefined' ) {
+                               // W3C
+                               begin       = textarea.selectionStart;
                                end         = textarea.selectionEnd;
-                               selection   = textarea.value.substring( start, end );
+                               selection   = textarea.value.substring( begin, end );
                                html        = html + selection + '</a>';
-                               cursor      = start + html.length;
+                               cursor      = begin + html.length;
 
                                // If no next is selected, place the cursor inside the closing tag.
-                               if ( start == end )
+                               if ( begin == end )
                                        cursor -= '</a>'.length;
 
-                               textarea.value = textarea.value.substring( 0, start )
+                               textarea.value = textarea.value.substring( 0, begin )
                                               + html
                                               + textarea.value.substring( end, textarea.value.length );
 
                                // Update cursor position
                                textarea.selectionStart = textarea.selectionEnd = cursor;
-
-                       // IE
-                       // Note: If no text is selected, IE will not place the cursor
-                       //       inside the closing tag.
-                       } else if ( document.selection && wpLink.range ) {
-                               textarea.focus();
-                               wpLink.range.text = html + wpLink.range.text + '</a>';
-                               wpLink.range.moveToBookmark( wpLink.range.getBookmark() );
-                               wpLink.range.select();
-
-                               wpLink.range = null;
                        }
 
                        wpLink.close();
@@ -243,7 +242,7 @@ var wpLink;
 
                        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#') {