Make WordPress Core

Ticket #38667: 38667.1.diff

File 38667.1.diff, 3.7 KB (added by westonruter, 8 years ago)
  • src/wp-admin/css/customize-controls.css

    diff --git src/wp-admin/css/customize-controls.css src/wp-admin/css/customize-controls.css
    index 2841557..a057532 100644
    p.customize-section-description { 
    11291129        margin-left: 10px;
    11301130        margin-right: 10px;
    11311131}
     1132#customize-theme-controls #sub-accordion-section-custom_css textarea {
     1133        tab-size: 4;
     1134}
    11321135
    11331136#sub-accordion-section-custom_css .customize-control-notifications-container {
    11341137        margin-bottom: 15px;
  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 30e98ea..cb177c6 100644
     
    52345234                        });
    52355235                });
    52365236
     5237                // Allow tabs to be entered in Custom CSS textarea.
     5238                api.control( 'custom_css', function ( control ) {
     5239                        control.deferred.embedded.done( function allowTabs() {
     5240                                var $textarea = control.container.find( 'textarea' ), textarea = $textarea[0];
     5241
     5242                                $textarea.on( 'blur', function() {
     5243                                        $textarea.data( 'next-tab-blurs', false );
     5244                                } );
     5245
     5246                                $textarea.on( 'keydown', function onKeydown( event ) {
     5247                                        var selectionStart, selectionEnd, value, scroll;
     5248
     5249                                        if ( 27 === event.keyCode ) { // Escape key.
     5250                                                // When pressing Escape: Opera 12 and 27 blur form fields.
     5251                                                event.preventDefault();
     5252
     5253                                                if ( true !== $textarea.data( 'next-tab-blurs' ) ) {
     5254                                                        $textarea.data( 'next-tab-blurs', true );
     5255                                                        event.stopPropagation(); // Prevent collapsing the section.
     5256                                                }
     5257                                                return;
     5258                                        }
     5259
     5260                                        // Short-circuit if tab key is not being pressed or if a modifier key *is* being pressed.
     5261                                        if ( 9 !== event.keyCode || event.ctrlKey || event.altKey || event.shiftKey ) { // Tab key.
     5262                                                return;
     5263                                        }
     5264
     5265                                        // Prevent capturing Tab characters if Esc was pressed.
     5266                                        if ( $textarea.data( 'next-tab-blurs' ) ) {
     5267                                                return;
     5268                                        }
     5269
     5270                                        selectionStart = textarea.selectionStart;
     5271                                        selectionEnd = textarea.selectionEnd;
     5272                                        value = textarea.value;
     5273
     5274                                        if ( selectionStart >= 0 ) {
     5275                                                scroll = $textarea.scrollTop;
     5276                                                textarea.value = value.substring( 0, selectionStart ).concat( '\t', value.substring( selectionEnd ) );
     5277                                                $textarea.selectionStart = textarea.selectionEnd = selectionStart + 1;
     5278                                                textarea.scrollTop = scroll;
     5279                                        }
     5280
     5281                                        event.stopPropagation();
     5282                                        event.preventDefault();
     5283                                } );
     5284                        } );
     5285                } );
     5286
    52375287                // Update the setting validities.
    52385288                api.previewer.bind( 'selective-refresh-setting-validities', function handleSelectiveRefreshedSettingValidities( settingValidities ) {
    52395289                        api._handleSettingValidities( {
  • src/wp-includes/class-wp-customize-manager.php

    diff --git src/wp-includes/class-wp-customize-manager.php src/wp-includes/class-wp-customize-manager.php
    index 3058138..1c00703 100644
    final class WP_Customize_Manager { 
    35903590                        'priority'           => 200,
    35913591                        'description_hidden' => true,
    35923592                        'description'        => sprintf( '%s<br /><a href="%s" class="external-link" target="_blank">%s<span class="screen-reader-text">%s</span></a>',
    3593                                 __( 'CSS allows you to customize the appearance and layout of your site with code. Separate CSS is saved for each of your themes.' ),
     3593                                __( 'CSS allows you to customize the appearance and layout of your site with code. Separate CSS is saved for each of your themes. In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ),
    35943594                                'https://codex.wordpress.org/Know_Your_Sources#CSS',
    35953595                                __( 'Learn more about CSS' ),
    35963596                                __( '(link opens in a new window)' )