wpLink:
- Fix adding a link on pressing Enter. - Don't auto-focus the URL field after selecting a local link. - Don't auto-focus the URL field when opening on touch devices. Toggle focus/blur on it to close the onscreen keyboard so the modal is positioned properly. See #28897. Built from https://develop.svn.wordpress.org/trunk@29333 git-svn-id: http://core.svn.wordpress.org/trunk@29113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4bff4ff2d6
commit
d15f9617f9
|
@ -1376,7 +1376,7 @@ final class _WP_Editors {
|
||||||
<?php wp_nonce_field( 'internal-linking', '_ajax_linking_nonce', false ); ?>
|
<?php wp_nonce_field( 'internal-linking', '_ajax_linking_nonce', false ); ?>
|
||||||
<div id="link-modal-title">
|
<div id="link-modal-title">
|
||||||
<?php _e( 'Insert/edit link' ) ?>
|
<?php _e( 'Insert/edit link' ) ?>
|
||||||
<button id="wp-link-close"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
|
<button type="button" id="wp-link-close"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
|
||||||
</div>
|
</div>
|
||||||
<div id="link-selector">
|
<div id="link-selector">
|
||||||
<div id="link-options">
|
<div id="link-options">
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
var wpLink;
|
var wpLink;
|
||||||
|
|
||||||
( function( $ ) {
|
( function( $ ) {
|
||||||
var inputs = {}, rivers = {}, editor, searchTimer, River, Query;
|
var editor, searchTimer, River, Query,
|
||||||
|
inputs = {},
|
||||||
|
rivers = {},
|
||||||
|
isTouch = ( 'ontouchend' in document );
|
||||||
|
|
||||||
wpLink = {
|
wpLink = {
|
||||||
timeToTriggerRiver: 150,
|
timeToTriggerRiver: 150,
|
||||||
|
@ -53,7 +56,7 @@ var wpLink;
|
||||||
rivers.elements.on( 'river-select', wpLink.updateFields );
|
rivers.elements.on( 'river-select', wpLink.updateFields );
|
||||||
|
|
||||||
// Display 'hint' message when search field or 'query-results' box are focused
|
// Display 'hint' message when search field or 'query-results' box are focused
|
||||||
inputs.search.add( rivers.elements ).on( 'focus.wplink', function() {
|
inputs.search.on( 'focus.wplink', function() {
|
||||||
inputs.queryNoticeTextDefault.hide();
|
inputs.queryNoticeTextDefault.hide();
|
||||||
inputs.queryNoticeTextHint.removeClass( 'screen-reader-text' ).show();
|
inputs.queryNoticeTextHint.removeClass( 'screen-reader-text' ).show();
|
||||||
} ).on( 'blur.wplink', function() {
|
} ).on( 'blur.wplink', function() {
|
||||||
|
@ -120,18 +123,26 @@ var wpLink;
|
||||||
rivers.search.refresh();
|
rivers.search.refresh();
|
||||||
rivers.recent.refresh();
|
rivers.recent.refresh();
|
||||||
|
|
||||||
if ( wpLink.isMCE() )
|
if ( wpLink.isMCE() ) {
|
||||||
wpLink.mceRefresh();
|
wpLink.mceRefresh();
|
||||||
else
|
} else {
|
||||||
wpLink.setDefaultValues();
|
wpLink.setDefaultValues();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( isTouch ) {
|
||||||
|
// Close the onscreen keyboard
|
||||||
|
inputs.url.focus().blur();
|
||||||
|
} else {
|
||||||
|
// Focus the URL field and highlight its contents.
|
||||||
|
// If this is moved above the selection changes,
|
||||||
|
// IE will show a flashing cursor over the dialog.
|
||||||
|
inputs.url.focus()[0].select();
|
||||||
|
}
|
||||||
|
|
||||||
// Focus the URL field and highlight its contents.
|
|
||||||
// If this is moved above the selection changes,
|
|
||||||
// IE will show a flashing cursor over the dialog.
|
|
||||||
inputs.url.focus()[0].select();
|
|
||||||
// Load the most recent results if this is the first time opening the panel.
|
// Load the most recent results if this is the first time opening the panel.
|
||||||
if ( ! rivers.recent.ul.children().length )
|
if ( ! rivers.recent.ul.children().length ) {
|
||||||
rivers.recent.ajax();
|
rivers.recent.ajax();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mceRefresh: function() {
|
mceRefresh: function() {
|
||||||
|
@ -274,11 +285,9 @@ var wpLink;
|
||||||
editor.selection.collapse();
|
editor.selection.collapse();
|
||||||
},
|
},
|
||||||
|
|
||||||
updateFields: function( e, li, originalEvent ) {
|
updateFields: function( e, li ) {
|
||||||
inputs.url.val( li.children( '.item-permalink' ).val() );
|
inputs.url.val( li.children( '.item-permalink' ).val() );
|
||||||
inputs.title.val( li.hasClass( 'no-title' ) ? '' : li.children( '.item-title' ).text() );
|
inputs.title.val( li.hasClass( 'no-title' ) ? '' : li.children( '.item-title' ).text() );
|
||||||
if ( originalEvent && originalEvent.type == 'click' )
|
|
||||||
inputs.url.focus();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
setDefaultValues: function() {
|
setDefaultValues: function() {
|
||||||
|
@ -364,7 +373,8 @@ var wpLink;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( inputs.url.is( ':focus' ) || inputs.title.is( ':focus' ) ) {
|
if ( document.activeElement &&
|
||||||
|
( document.activeElement.id === 'link-title-field' || document.activeElement.id === 'url-field' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
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.0-beta2-20140730';
|
$wp_version = '4.0-beta2-20140731';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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