wpLink: Make the text editor experience the same as in the visual editor.
props azaozz. fixes #31890. Built from https://develop.svn.wordpress.org/trunk@32242 git-svn-id: http://core.svn.wordpress.org/trunk@32213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5775586646
commit
d672824273
|
@ -142,6 +142,8 @@ var wpLink;
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function() {
|
refresh: function() {
|
||||||
|
var text = '';
|
||||||
|
|
||||||
// Refresh rivers (clear links, check visibility)
|
// Refresh rivers (clear links, check visibility)
|
||||||
rivers.search.refresh();
|
rivers.search.refresh();
|
||||||
rivers.recent.refresh();
|
rivers.recent.refresh();
|
||||||
|
@ -149,8 +151,21 @@ var wpLink;
|
||||||
if ( wpLink.isMCE() ) {
|
if ( wpLink.isMCE() ) {
|
||||||
wpLink.mceRefresh();
|
wpLink.mceRefresh();
|
||||||
} else {
|
} else {
|
||||||
inputs.wrap.removeClass( 'has-text-field' );
|
// For the Text editor the "Link text" field is always shown
|
||||||
inputs.text.val( '' );
|
if ( ! inputs.wrap.hasClass( 'has-text-field' ) ) {
|
||||||
|
inputs.wrap.addClass( 'has-text-field' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( document.selection ) {
|
||||||
|
// Old IE
|
||||||
|
text = document.selection.createRange().text || '';
|
||||||
|
} else if ( typeof this.textarea.selectionStart !== 'undefined' &&
|
||||||
|
( this.textarea.selectionStart !== this.textarea.selectionEnd ) ) {
|
||||||
|
// W3C
|
||||||
|
text = this.textarea.value.substring( this.textarea.selectionStart, this.textarea.selectionEnd ) || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
inputs.text.val( text );
|
||||||
wpLink.setDefaultValues();
|
wpLink.setDefaultValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-RC2-32233';
|
$wp_version = '4.2-RC2-32242';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue