Make it possible to tab out of the plugin and theme editors textareas by pressing Esc followed by Tab, fixes #21347

git-svn-id: https://develop.svn.wordpress.org/trunk@21310 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2012-07-23 23:46:27 +00:00
parent 29173ed46c
commit dda796260d
3 changed files with 26 additions and 12 deletions
+17 -3
View File
@@ -321,10 +321,24 @@ $(document).ready( function() {
// tab in textareas
$('#newcontent').bind('keydown.wpevent_InsertTab', function(e) {
if ( e.keyCode != 9 )
return true;
var el = e.target, selStart, selEnd, val, scroll, sel;
var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel;
if ( e.keyCode == 27 ) { // escape key
$(el).data('tab-out', true);
return;
}
if ( e.keyCode != 9 || e.ctrlKey || e.altKey || e.shiftKey ) // tab key
return;
if ( $(el).data('tab-out') ) {
$(el).data('tab-out', false);
return;
}
selStart = el.selectionStart;
selEnd = el.selectionEnd;
val = el.value;
try {
this.lastKey = 9; // not a standard DOM property, lastKey is to help stop Opera tab event. See blur handler below.