mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 08:11:52 +01:00
Menus: Restore the title of the currently active/expanded menu item when clicking "Cancel" after editing.
Other inputs are already restored to their previous values in that case. Props Girishpanchal, nilamacharya, JoshuaWold, welcher, SergeyBiryukov. Fixes #43031. Built from https://develop.svn.wordpress.org/trunk@47294 git-svn-id: http://core.svn.wordpress.org/trunk@47094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
74b90a6b45
commit
5875ad981b
@ -1162,6 +1162,7 @@
|
||||
eventOnClickEditLink : function(clickedEl) {
|
||||
var settings, item,
|
||||
matchedSection = /#(.*)$/.exec(clickedEl.href);
|
||||
|
||||
if ( matchedSection && matchedSection[1] ) {
|
||||
settings = $('#'+matchedSection[1]);
|
||||
item = settings.parent();
|
||||
@ -1186,8 +1187,12 @@
|
||||
eventOnClickCancelLink : function(clickedEl) {
|
||||
var settings = $( clickedEl ).closest( '.menu-item-settings' ),
|
||||
thisMenuItem = $( clickedEl ).closest( '.menu-item' );
|
||||
|
||||
thisMenuItem.removeClass( 'menu-item-edit-active' ).addClass( 'menu-item-edit-inactive' );
|
||||
settings.setItemData( settings.data( 'menu-item-data' ) ).hide();
|
||||
// Restore the title of the currently active/expanded menu item.
|
||||
thisMenuItem.find( '.menu-item-title' ).text( settings.data( 'menu-item-data' )['menu-item-title'] );
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
@ -1195,6 +1200,7 @@
|
||||
var locs = '',
|
||||
menuName = $('#menu-name'),
|
||||
menuNameVal = menuName.val();
|
||||
|
||||
// Cancel and warn if invalid menu name.
|
||||
if ( ! menuNameVal || ! menuNameVal.replace( /\s+/, '' ) ) {
|
||||
menuName.parent().addClass( 'form-invalid' );
|
||||
@ -1223,6 +1229,7 @@
|
||||
|
||||
eventOnClickMenuItemDelete : function(clickedEl) {
|
||||
var itemID = parseInt(clickedEl.id.replace('delete-', ''), 10);
|
||||
|
||||
api.removeMenuItem( $('#menu-item-' + itemID) );
|
||||
api.registerChange();
|
||||
return false;
|
||||
|
2
wp-admin/js/nav-menu.min.js
vendored
2
wp-admin/js/nav-menu.min.js
vendored
File diff suppressed because one or more lines are too long
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4-beta1-47293';
|
||||
$wp_version = '5.4-beta1-47294';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user