} else {
wpLink.setDefaultValues();
}
-
- tinyMCEPopup.storeSelection();
},
close : function() {
// 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);
return;
}
- tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
if (e == null) {
ed.getDoc().execCommand("unlink", false, null);
tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
// 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;
}
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 ) {