Customize: Fix regression in ability to create submenus for nav menus via drag and drop.

See #34391.
Fixes #38948.
Props delawski, adamsilverstein.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-11-30 17:43:43 +00:00
parent f630dd7b64
commit b2c12e463a
3 changed files with 19 additions and 10 deletions

View File

@ -1029,7 +1029,7 @@
},
onChangeExpanded: function( expanded, args ) {
var section = this;
var section = this, completeCallback;
if ( expanded ) {
wpNavMenu.menuList = section.contentContainer;
@ -1045,13 +1045,22 @@
}
} );
if ( 'resolved' !== section.deferred.initSortables.state() ) {
wpNavMenu.initSortables(); // Depends on menu-to-edit ID being set above.
section.deferred.initSortables.resolve( wpNavMenu.menuList ); // Now MenuControl can extend the sortable.
// @todo Note that wp.customize.reflowPaneContents() is debounced, so this immediate change will show a slight flicker while priorities get updated.
api.control( 'nav_menu[' + String( section.params.menu_id ) + ']' ).reflowMenuItems();
// Make sure Sortables is initialized after the section has been expanded to prevent `offset` issues.
if ( args.completeCallback ) {
completeCallback = args.completeCallback;
}
args.completeCallback = function() {
if ( 'resolved' !== section.deferred.initSortables.state() ) {
wpNavMenu.initSortables(); // Depends on menu-to-edit ID being set above.
section.deferred.initSortables.resolve( wpNavMenu.menuList ); // Now MenuControl can extend the sortable.
// @todo Note that wp.customize.reflowPaneContents() is debounced, so this immediate change will show a slight flicker while priorities get updated.
api.control( 'nav_menu[' + String( section.params.menu_id ) + ']' ).reflowMenuItems();
}
if ( _.isFunction( completeCallback ) ) {
completeCallback();
}
};
}
api.Section.prototype.onChangeExpanded.call( section, expanded, args );
}

File diff suppressed because one or more lines are too long

View File

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