From 8e84510ebb5f0cc1f06227ab87e94b0723fec6b7 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Wed, 5 Jul 2017 00:43:11 +0000 Subject: [PATCH] Customize: Fix logic to re-expand a newly inserted nav menu section after placeholder section is replaced. Fixes todo from Menu Customizer feature plugin: https://github.com/voldemortensen/menu-customizer/commit/0f4ea4e#diff-daa55fade2253f26ccbe02f71058841cR2330 Amends [32806]. Props greuben. See #32576. Fixes #40997. git-svn-id: https://develop.svn.wordpress.org/trunk@41001 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/customize-nav-menus.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/js/customize-nav-menus.js b/src/wp-admin/js/customize-nav-menus.js index 9cd39c96f6..893dd42232 100644 --- a/src/wp-admin/js/customize-nav-menus.js +++ b/src/wp-admin/js/customize-nav-menus.js @@ -2852,7 +2852,7 @@ var insertedMenuIdMapping = {}, insertedMenuItemIdMapping = {}; _( data.nav_menu_updates ).each(function( update ) { - var oldCustomizeId, newCustomizeId, customizeId, oldSetting, newSetting, setting, settingValue, oldSection, newSection, wasSaved, widgetTemplate, navMenuCount; + var oldCustomizeId, newCustomizeId, customizeId, oldSetting, newSetting, setting, settingValue, oldSection, newSection, wasSaved, widgetTemplate, navMenuCount, shouldExpandNewSection; if ( 'inserted' === update.status ) { if ( ! update.previous_term_id ) { throw new Error( 'Expected previous_term_id' ); @@ -2884,7 +2884,8 @@ previewer: api.previewer } ); - if ( oldSection.expanded() ) { + shouldExpandNewSection = oldSection.expanded(); + if ( shouldExpandNewSection ) { oldSection.collapse(); } @@ -2959,8 +2960,7 @@ } } ); - if ( oldSection.expanded.get() ) { - // @todo This doesn't seem to be working. + if ( shouldExpandNewSection ) { newSection.expand(); } } else if ( 'updated' === update.status ) {