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.

Built from https://develop.svn.wordpress.org/trunk@41001


git-svn-id: http://core.svn.wordpress.org/trunk@40851 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-07-05 00:44:41 +00:00
parent 046fb8a987
commit 7b28ff2f2a
3 changed files with 6 additions and 6 deletions

View File

@ -2852,7 +2852,7 @@
var insertedMenuIdMapping = {}, insertedMenuItemIdMapping = {}; var insertedMenuIdMapping = {}, insertedMenuItemIdMapping = {};
_( data.nav_menu_updates ).each(function( update ) { _( 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 ( 'inserted' === update.status ) {
if ( ! update.previous_term_id ) { if ( ! update.previous_term_id ) {
throw new Error( 'Expected previous_term_id' ); throw new Error( 'Expected previous_term_id' );
@ -2884,7 +2884,8 @@
previewer: api.previewer previewer: api.previewer
} ); } );
if ( oldSection.expanded() ) { shouldExpandNewSection = oldSection.expanded();
if ( shouldExpandNewSection ) {
oldSection.collapse(); oldSection.collapse();
} }
@ -2959,8 +2960,7 @@
} }
} ); } );
if ( oldSection.expanded.get() ) { if ( shouldExpandNewSection ) {
// @todo This doesn't seem to be working.
newSection.expand(); newSection.expand();
} }
} else if ( 'updated' === update.status ) { } else if ( 'updated' === update.status ) {

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-alpha-41000'; $wp_version = '4.9-alpha-41001';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.