Customize: Fix regression in ability to create submenus for nav menus via drag and drop.
See #34391. Fixes #38948. Props delawski, adamsilverstein. git-svn-id: https://develop.svn.wordpress.org/trunk@39376 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
74efb754fd
commit
1c893a5b46
|
@ -1029,7 +1029,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
onChangeExpanded: function( expanded, args ) {
|
onChangeExpanded: function( expanded, args ) {
|
||||||
var section = this;
|
var section = this, completeCallback;
|
||||||
|
|
||||||
if ( expanded ) {
|
if ( expanded ) {
|
||||||
wpNavMenu.menuList = section.contentContainer;
|
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() ) {
|
if ( 'resolved' !== section.deferred.initSortables.state() ) {
|
||||||
wpNavMenu.initSortables(); // Depends on menu-to-edit ID being set above.
|
wpNavMenu.initSortables(); // Depends on menu-to-edit ID being set above.
|
||||||
section.deferred.initSortables.resolve( wpNavMenu.menuList ); // Now MenuControl can extend the sortable.
|
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.
|
// @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();
|
api.control( 'nav_menu[' + String( section.params.menu_id ) + ']' ).reflowMenuItems();
|
||||||
}
|
}
|
||||||
|
if ( _.isFunction( completeCallback ) ) {
|
||||||
|
completeCallback();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
api.Section.prototype.onChangeExpanded.call( section, expanded, args );
|
api.Section.prototype.onChangeExpanded.call( section, expanded, args );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue