Tabbing in Editors: Prevent certain browsers from Tabbing out of the field. Props filosofo. Fixes #12424
git-svn-id: http://svn.automattic.com/wordpress/trunk@13548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
65b22dcf9c
commit
4c7070fb41
|
@ -269,14 +269,15 @@ jQuery(document).ready( function($) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// tab in textareas
|
// tab in textareas
|
||||||
$('textarea#newcontent').keydown(function(e) {
|
$('#newcontent').keydown(function(e) {
|
||||||
if ( e.keyCode != 9 )
|
if ( e.keyCode != 9 )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel;
|
var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel;
|
||||||
|
|
||||||
e.stopPropagation();
|
try {
|
||||||
e.preventDefault();
|
this.lastKey = 9; // not a standard DOM property, lastKey is to help stop Opera tab event. See blur handler below.
|
||||||
|
} catch(err) {}
|
||||||
|
|
||||||
if ( document.selection ) {
|
if ( document.selection ) {
|
||||||
el.focus();
|
el.focus();
|
||||||
|
@ -288,6 +289,16 @@ jQuery(document).ready( function($) {
|
||||||
el.selectionStart = el.selectionEnd = selStart + 1;
|
el.selectionStart = el.selectionEnd = selStart + 1;
|
||||||
this.scrollTop = scroll;
|
this.scrollTop = scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( e.stopPropagation )
|
||||||
|
e.stopPropagation();
|
||||||
|
if ( e.preventDefault )
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#newcontent').blur(function(e) {
|
||||||
|
if ( this.lastKey && 9 == this.lastKey )
|
||||||
|
this.focus();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -60,7 +60,7 @@ function wp_default_scripts( &$scripts ) {
|
||||||
|
|
||||||
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
|
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
|
||||||
|
|
||||||
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20100218' );
|
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20100302' );
|
||||||
$scripts->add_data( 'common', 'group', 1 );
|
$scripts->add_data( 'common', 'group', 1 );
|
||||||
$scripts->localize( 'common', 'commonL10n', array(
|
$scripts->localize( 'common', 'commonL10n', array(
|
||||||
'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
|
'warnDelete' => __("You are about to permanently delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
|
||||||
|
|
Loading…
Reference in New Issue