mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Allow tab to intent in plugin/theme editors. Reverts first pass, [13131]. Props azaozz, fixes #12204
git-svn-id: https://develop.svn.wordpress.org/trunk@13191 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -267,6 +267,28 @@ jQuery(document).ready( function($) {
|
||||
$('div.default-password-nag').hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
// tab in textareas
|
||||
$('textarea#newcontent').keydown(function(e) {
|
||||
if ( e.keyCode != 9 )
|
||||
return true;
|
||||
|
||||
var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel;
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if ( document.selection ) {
|
||||
el.focus();
|
||||
sel = document.selection.createRange();
|
||||
sel.text = '\t';
|
||||
} else if ( selStart >= 0 ) {
|
||||
scroll = this.scrollTop;
|
||||
el.value = val.substring(0, selStart).concat('\t', val.substring(selEnd) );
|
||||
el.selectionStart = el.selectionEnd = selStart + 1;
|
||||
this.scrollTop = scroll;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
jQuery(document).ready( function($){
|
||||
|
||||
Reference in New Issue
Block a user