Make WordPress Core

Ticket #12204: 12204-2.patch

File 12204-2.patch, 987 bytes (added by azaozz, 15 years ago)
  • wp-admin/js/common.dev.js

     
    267267                $('div.default-password-nag').hide();
    268268                return false;
    269269        });
     270
     271        // tab in textareas
     272        $('textarea#newcontent').keydown(function(e) {
     273                if ( e.keyCode != 9 )
     274                        return true;
     275
     276                var el = e.target, selStart = el.selectionStart, selEnd = el.selectionEnd, val = el.value, scroll, sel;
     277
     278                e.stopPropagation();
     279                e.preventDefault();
     280
     281                if ( document.selection ) {
     282            el.focus();
     283            sel = document.selection.createRange();
     284            sel.text = '\t';
     285         } else if ( selStart >= 0 ) {
     286                        scroll = this.scrollTop;
     287                        el.value = val.substring(0, selStart).concat('\t', val.substring(selEnd) );
     288                        el.selectionStart = el.selectionEnd = selStart + 1;
     289                        this.scrollTop = scroll;
     290                }
     291        });
    270292});
    271293
    272294jQuery(document).ready( function($){