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
This commit is contained in:
Weston Ruter 2017-07-05 00:43:11 +00:00
parent ebb7793cc6
commit 8e84510ebb
1 changed files with 4 additions and 4 deletions

View File

@ -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 ) {