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:
parent
ebb7793cc6
commit
8e84510ebb
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in New Issue