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

See #34391.
Fixes #38948 for 4.7 branch.
Props delawski, adamsilverstein.

Built from https://develop.svn.wordpress.org/branches/4.7@39377


git-svn-id: http://core.svn.wordpress.org/branches/4.7@39317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-11-30 17:45:34 +00:00
parent 6d161ba61a
commit ea8b01eac6
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,6 +1045,11 @@
}
} );
// 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.
@ -1052,6 +1057,10 @@
// @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.7-RC1-39374';
$wp_version = '4.7-RC1-39377';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.