Make WordPress Core

Ticket #39101: 39101.diff

File 39101.diff, 751 bytes (added by sirbrillig, 8 years ago)

Prevent adding edit shortcut for nav menus inside widgets

  • 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 0735b23..2f0c8f1 100644
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    120120                        if ( ! $placementContainer.length || $placementContainer.is( illegalContainerSelector ) || $placementContainer.closest( illegalAncestorSelector ).length ) {
    121121                                return;
    122122                        }
     123                        if ( 'nav_menu' === partial.getType() && $placementContainer.closest( '.widget_nav_menu' ).length ) {
     124                                return;
     125                        }
    123126                        $shortcut = partial.createEditShortcut();
    124127                        $shortcut.on( 'click', function( event ) {
    125128                                event.preventDefault();