Customize: Fix behavior of clicking Delete Menu link and keep available nav menu items panel open when doing bulk deletion.

Props maguiar, adamsilverstein for testing.
Amends [39548].
Fixes #38953.

Merges [40396] to the 4.7 branch.


git-svn-id: https://develop.svn.wordpress.org/branches/4.7@40401 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler 2017-04-10 12:28:08 +00:00
parent 4c580ff912
commit fd09e9b680
1 changed files with 9 additions and 2 deletions

View File

@ -1323,7 +1323,14 @@
this.container.find( '.menu-item-handle' ).on( 'click', function( e ) {
e.preventDefault();
e.stopPropagation();
var menuControl = control.getMenuControl();
var menuControl = control.getMenuControl(),
isDeleteBtn = $( e.target ).is( '.item-delete, .item-delete *' ),
isAddNewBtn = $( e.target ).is( '.add-new-menu-item, .add-new-menu-item *' );
if ( $( 'body' ).hasClass( 'adding-menu-items' ) && ! isDeleteBtn && ! isAddNewBtn ) {
api.Menus.availableMenuItemsPanel.close();
}
if ( menuControl.isReordering || menuControl.isSorting ) {
return;
}
@ -2214,7 +2221,7 @@
}
} );
control.container.find( '.menu-delete' ).on( 'click', function( event ) {
control.container.find( '.menu-delete-item' ).on( 'click', function( event ) {
event.stopPropagation();
event.preventDefault();
control.setting.set( false );