Make WordPress Core

Ticket #27403: 27403-persistent-shortcuts.2.diff

File 27403-persistent-shortcuts.2.diff, 5.1 KB (added by westonruter, 8 years ago)
  • src/wp-admin/customize.php

    diff --git src/wp-admin/customize.php src/wp-admin/customize.php
    index 89d385d..eea5ddc 100644
    do_action( 'customize_controls_print_scripts' ); 
    192192                                <?php endforeach; ?>
    193193                        </div>
    194194                        <?php endif; ?>
    195                         <button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
     195                        <button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e( 'Hide Controls' ); ?>">
    196196                                <span class="collapse-sidebar-arrow"></span>
    197                                 <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
     197                                <span class="collapse-sidebar-label"><?php _e( 'Hide Controls' ); ?></span>
    198198                        </button>
    199199                </div>
    200200        </form>
  • src/wp-admin/js/customize-controls.js

    diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js
    index 39f1b4f..811d3ab 100644
     
    52075207                        expandedPanel( false );
    52085208                        expandedSection( false );
    52095209                        previewerAlive( true );
    5210                         editShortcutVisibility( 'initial' );
     5210                        editShortcutVisibility( 'visible' );
    52115211
    52125212                        api.bind( 'change', function() {
    52135213                                state('saved').set( false );
     
    58135813                });
    58145814
    58155815                // Update the edit shortcut visibility state.
     5816                api.state( 'paneVisible' ).bind( function( isPaneVisible ) {
     5817                        var isMobileScreen;
     5818                        if ( window.matchMedia ) {
     5819                                isMobileScreen = window.matchMedia( 'screen and ( max-width: 640px )' ).matches;
     5820                        } else {
     5821                                isMobileScreen = $( window ).width() <= 640;
     5822                        }
     5823                        api.state( 'editShortcutVisibility' ).set( isPaneVisible || isMobileScreen ? 'visible' : 'hidden' );
     5824                } );
     5825                if ( window.matchMedia ) {
     5826                        window.matchMedia( 'screen and ( max-width: 640px )' ).addListener( function() {
     5827                                var state = api.state( 'paneVisible' );
     5828                                state.callbacks.fireWith( state, [ state.get(), state.get() ] );
     5829                        } );
     5830                }
    58165831                api.previewer.bind( 'edit-shortcut-visibility', function( visibility ) {
    58175832                        api.state( 'editShortcutVisibility' ).set( visibility );
    58185833                } );
  • src/wp-includes/css/customize-preview.css

    diff --git src/wp-includes/css/customize-preview.css src/wp-includes/css/customize-preview.css
    index a388488..fee3b7b 100644
    body.customize-partial-edit-shortcuts-hidden .customize-partial-edit-shortcut:be 
    8080        pointer-events: none;
    8181}
    8282
    83 body.customize-partial-edit-shortcuts-flash .customize-partial-edit-shortcut:before {
    84         animation-duration: 1.5s;
    85         animation-delay: 0.4s;
    86         animation-name: customize-partial-edit-shortcut-bounce-disappear;
    87         pointer-events: none;
    88 }
    89 
    9083.page-sidebar-collapsed .customize-partial-edit-shortcut:before,
    9184.customize-partial-edit-shortcut-hidden:before {
    9285        visibility: hidden;
  • src/wp-includes/js/customize-selective-refresh.js

    diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
    index 0fc06e9..bfbb2ef 100644
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    996996                        shouldAnimateHide = ( 'hidden' === visibility && body.hasClass( 'customize-partial-edit-shortcuts-shown' ) && ! body.hasClass( 'customize-partial-edit-shortcuts-hidden' ) );
    997997                        body.toggleClass( 'customize-partial-edit-shortcuts-hidden', shouldAnimateHide );
    998998                        body.toggleClass( 'customize-partial-edit-shortcuts-shown', 'visible' === visibility );
    999                         body.toggleClass( 'customize-partial-edit-shortcuts-flash', 'initial' === visibility );
    1000999                } );
    10011000
    10021001                api.preview.bind( 'active', function() {
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    10221021                        self.partial.bind( 'add', function( partial ) {
    10231022                                partial.deferred.ready.resolve();
    10241023                        } );
    1025 
    1026                         body.on( 'click', function( event ) {
    1027                                 if ( event.shiftKey || $( event.target ).is( '.customize-partial-edit-shortcut, :input, button *, a[href], a[href] *, object, object *, [tabindex], [tabindex] *' ) ) {
    1028                                         return; // Don't toggle shortcuts on shift-clicks or clicks on (or in) interactive elements.
    1029                                 }
    1030                                 api.selectiveRefresh.editShortcutVisibility.set( 'visible' === api.selectiveRefresh.editShortcutVisibility.get() ? 'hidden' : 'visible' );
    1031                                 api.preview.send( 'edit-shortcut-visibility', api.selectiveRefresh.editShortcutVisibility.get() );
    1032                         } );
    10331024                } );
    10341025
    10351026        } );
  • src/wp-includes/script-loader.php

    diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
    index 378ce1a..78a18a0 100644
    function wp_default_scripts( &$scripts ) { 
    465465                'notAllowed'         => __( 'Sorry, you are not allowed to customize this site.' ),
    466466                'previewIframeTitle' => __( 'Site Preview' ),
    467467                'loginIframeTitle'   => __( 'Session expired' ),
    468                 'collapseSidebar'    => __( 'Collapse Sidebar' ),
    469                 'expandSidebar'      => __( 'Expand Sidebar' ),
     468                'collapseSidebar'    => __( 'Hide Controls' ),
     469                'expandSidebar'      => __( 'Show Controls' ),
    470470                'untitledBlogName'   => __( '(Untitled)' ),
    471471                // Used for overriding the file types allowed in plupload.
    472472                'allowedFiles'       => __( 'Allowed Files' ),