Make WordPress Core

Changeset 38972


Ignore:
Timestamp:
10/26/2016 10:37:35 PM (8 years ago)
Author:
westonruter
Message:

Customize: Remove unnecessary code for edit shortcuts which is no longer required due to moving buttons inside of partial placement containers.

Props sirbrillig.
Amends [38967].
See #27403.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/css/customize-preview.css

    r38967 r38972  
    9393}
    9494
    95 .widget button.customize-partial-edit-shortcut-absolute,
    96 .customize-partial-edit-shortcut-absolute {
    97     position: static;
    98 }
    99 
    10095.customize-partial-edit-shortcut-left-margin:before {
    10196    left: 0;
  • trunk/src/wp-includes/js/customize-selective-refresh.js

    r38967 r38972  
    142142            $placementContainer = $( placement.container );
    143143            $placementContainer.prepend( $editShortcut );
    144             if ( 'absolute' === $placementContainer.css( 'position' ) ) {
    145                 $editShortcut.addClass( 'customize-partial-edit-shortcut-absolute' );
    146                 $editShortcut.css( partial.getEditShortcutPositionStyles( $placementContainer ) );
    147                 partial.whenPageChanges( function() {
    148                     $editShortcut.css( partial.getEditShortcutPositionStyles( $placementContainer ) );
    149                 } );
    150             }
    151144            if ( ! $placementContainer.is( ':visible' ) || 'none' === $placementContainer.css( 'display' ) ) {
    152145                $editShortcut.addClass( 'customize-partial-edit-shortcut-hidden' );
    153146            }
    154147            $editShortcut.toggleClass( 'customize-partial-edit-shortcut-left-margin', $editShortcut.offset().left < 1 );
    155         },
    156 
    157         /**
    158          * Call a callback function when the page changes.
    159          *
    160          * This calls a callback for any change that might require refreshing the edit shortcuts.
    161          *
    162          * @since 4.7
    163          *
    164          * @param {Function} callback The function to call when the page changes.
    165          * @returns {void}
    166          */
    167         whenPageChanges: function( callback ) {
    168             var debouncedCallback, $document;
    169             debouncedCallback = _.debounce( function() {
    170                 // Timeout allows any page animations to finish
    171                 setTimeout( callback, 100 );
    172             }, 350 );
    173             // When window is resized.
    174             $( window ).resize( debouncedCallback );
    175             // When any customizer setting changes.
    176             api.bind( 'change', debouncedCallback );
    177             $document = $( window.document );
    178             // After scroll in case there are fixed position elements
    179             $document.on( 'scroll', debouncedCallback );
    180             // After page click (eg: hamburger menus)
    181             $document.on( 'click', debouncedCallback );
    182         },
    183 
    184         /**
    185          * Return the CSS positioning for the edit shortcut for a given partial placement.
    186          *
    187          * @since 4.7
    188          *
    189          * @param {jQuery} $placementContainer The placement container element as a jQuery object.
    190          * @return {Object} Object containing CSS positions.
    191          */
    192         getEditShortcutPositionStyles: function( $placementContainer ) {
    193             return {
    194                 top: $placementContainer.css( 'top' ),
    195                 left: $placementContainer.css( 'left' ),
    196                 right: 'auto'
    197             };
    198148        },
    199149
Note: See TracChangeset for help on using the changeset viewer.