Make WordPress Core

Ticket #38948: 38948.diff

File 38948.diff, 1.7 KB (added by adamsilverstein, 8 years ago)
  • src/wp-admin/js/customize-nav-menus.js

     
    10451045                                        }
    10461046                                } );
    10471047
    1048                                 if ( 'resolved' !== section.deferred.initSortables.state() ) {
    1049                                         wpNavMenu.initSortables(); // Depends on menu-to-edit ID being set above.
    1050                                         section.deferred.initSortables.resolve( wpNavMenu.menuList ); // Now MenuControl can extend the sortable.
     1048                                // Make sure Sortables is initialized after the section has been expanded to prevent `offset` issues.
     1049                                api.state( 'expandedSection' ).bind( $.proxy( function( newSection ) {
     1050                                        var section = this;
    10511051
    1052                                         // @todo Note that wp.customize.reflowPaneContents() is debounced, so this immediate change will show a slight flicker while priorities get updated.
    1053                                         api.control( 'nav_menu[' + String( section.params.menu_id ) + ']' ).reflowMenuItems();
    1054                                 }
     1052                                        if ( ! newSection || newSection.id !== section.id ) {
     1053                                                return false;
     1054                                        }
     1055
     1056                                        if ( 'resolved' !== section.deferred.initSortables.state() ) {
     1057
     1058                                                _.delay( function() {
     1059                                                        wpNavMenu.initSortables(); // Depends on menu-to-edit ID being set above.
     1060                                                        section.deferred.initSortables.resolve( wpNavMenu.menuList ); // Now MenuControl can extend the sortable.
     1061
     1062                                                        // @todo Note that wp.customize.reflowPaneContents() is debounced, so this immediate change will show a slight flicker while priorities get updated.
     1063                                                        api.control( 'nav_menu[' + String( section.params.menu_id ) + ']' ).reflowMenuItems();
     1064                                                }, 250 );
     1065                                        }
     1066                                }, section ) );
    10551067                        }
    10561068                        api.Section.prototype.onChangeExpanded.call( section, expanded, args );
    10571069                }