mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Only set and run internal search for linking selected text if the panel is open. Make sure the focus is in the URL field whenever opening the linking modal to preserve previous behavior. props greuben. fixes #16276.
git-svn-id: https://develop.svn.wordpress.org/trunk@25031 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
17267dd999
commit
123b419481
@ -279,26 +279,28 @@ var wpLink;
|
||||
inputs.url.focus();
|
||||
},
|
||||
setDefaultValues : function() {
|
||||
var selectedText,
|
||||
textarea = wpLink.textarea;
|
||||
|
||||
// Set URL and description to defaults.
|
||||
// Leave the new tab setting as-is.
|
||||
inputs.url.val('http://');
|
||||
inputs.title.val('');
|
||||
if ( wpLink.isMCE() ) {
|
||||
selectedText = tinyMCEPopup.editor.selection.getContent( { format: 'text' } );
|
||||
} else {
|
||||
if ( document.selection && wpLink.range ) {
|
||||
selectedText = wpLink.range.text;
|
||||
} else if ( typeof textarea.selectionStart !== 'undefined' ) {
|
||||
selectedText = textarea.value.substring( textarea.selectionStart, textarea.selectionEnd );
|
||||
|
||||
if ( $('#search-panel').is(':visible') ) {
|
||||
var selectedText,
|
||||
textarea = wpLink.textarea;
|
||||
|
||||
if ( wpLink.isMCE() ) {
|
||||
selectedText = tinyMCEPopup.editor.selection.getContent( { format: 'text' } );
|
||||
} else {
|
||||
if ( document.selection && wpLink.range ) {
|
||||
selectedText = wpLink.range.text;
|
||||
} else if ( 'undefined' !== typeof textarea.selectionStart ) {
|
||||
selectedText = textarea.value.substring( textarea.selectionStart, textarea.selectionEnd );
|
||||
}
|
||||
}
|
||||
|
||||
if ( selectedText && ( selectedText = selectedText.replace( /^\s+|\s+$/g, '' ) ) ) {
|
||||
inputs.search.val( selectedText ).trigger('keyup');
|
||||
}
|
||||
}
|
||||
if ( selectedText && ( selectedText = selectedText.replace( /^\s+|\s+$/g, '' ) ) ) {
|
||||
if ( ! $('#search-panel').is(':visible') )
|
||||
$('#internal-toggle').trigger('click');
|
||||
inputs.search.val( selectedText ).trigger('keyup');
|
||||
}
|
||||
|
||||
// Update save prompt.
|
||||
|
Loading…
x
Reference in New Issue
Block a user