Editor: remove wpLink dependency on jQuery UI.

Props afercia.
Fixes #34716.

git-svn-id: https://develop.svn.wordpress.org/trunk@35728 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-11-22 19:26:18 +00:00
parent fdde197d93
commit a78706fe36

View File

@ -459,13 +459,14 @@ var wpLink;
}, },
keydown: function( event ) { keydown: function( event ) {
var fn, id, var fn, id;
key = $.ui.keyCode;
if ( key.ESCAPE === event.keyCode ) { // Escape key.
if ( 27 === event.keyCode ) {
wpLink.close(); wpLink.close();
event.stopImmediatePropagation(); event.stopImmediatePropagation();
} else if ( key.TAB === event.keyCode ) { // Tab key.
} else if ( 9 === event.keyCode ) {
id = event.target.id; id = event.target.id;
// wp-link-submit must always be the last focusable element in the dialog. // wp-link-submit must always be the last focusable element in the dialog.
@ -479,7 +480,8 @@ var wpLink;
} }
} }
if ( event.keyCode !== key.UP && event.keyCode !== key.DOWN ) { // Up Arrow and Down Arrow keys.
if ( 38 !== event.keyCode && 40 !== event.keyCode ) {
return; return;
} }
@ -488,7 +490,8 @@ var wpLink;
return; return;
} }
fn = event.keyCode === key.UP ? 'prev' : 'next'; // Up Arrow key.
fn = 38 === event.keyCode ? 'prev' : 'next';
clearInterval( wpLink.keyInterval ); clearInterval( wpLink.keyInterval );
wpLink[ fn ](); wpLink[ fn ]();
wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity ); wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity );
@ -496,9 +499,8 @@ var wpLink;
}, },
keyup: function( event ) { keyup: function( event ) {
var key = $.ui.keyCode; // Up Arrow and Down Arrow keys.
if ( 38 === event.keyCode || 40 === event.keyCode ) {
if ( event.which === key.UP || event.which === key.DOWN ) {
clearInterval( wpLink.keyInterval ); clearInterval( wpLink.keyInterval );
event.preventDefault(); event.preventDefault();
} }