Live update the menu item title when the user is editing the "Navigation Label" field.
Props celloexpressions. See #23076. Built from https://develop.svn.wordpress.org/trunk@28707 git-svn-id: http://core.svn.wordpress.org/trunk@28523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c6d0dcc634
commit
b964ac0148
|
@ -507,6 +507,10 @@ ul.add-menu-item-tabs li {
|
||||||
margin-left: 13em;
|
margin-left: 13em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-item-handle .menu-item-title.no-title {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
/* Sortables */
|
/* Sortables */
|
||||||
li.menu-item.ui-sortable-helper dl {
|
li.menu-item.ui-sortable-helper dl {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
|
|
@ -507,6 +507,10 @@ ul.add-menu-item-tabs li {
|
||||||
margin-right: 13em;
|
margin-right: 13em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-item-handle .menu-item-title.no-title {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
/* Sortables */
|
/* Sortables */
|
||||||
li.menu-item.ui-sortable-helper dl {
|
li.menu-item.ui-sortable-helper dl {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -57,6 +57,8 @@ var wpNavMenu;
|
||||||
this.initAccessibility();
|
this.initAccessibility();
|
||||||
|
|
||||||
this.initToggles();
|
this.initToggles();
|
||||||
|
|
||||||
|
this.initPreviewing();
|
||||||
},
|
},
|
||||||
|
|
||||||
jQueryExtensions : function() {
|
jQueryExtensions : function() {
|
||||||
|
@ -530,6 +532,21 @@ var wpNavMenu;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
initPreviewing : function() {
|
||||||
|
// Update the item handle title when the navigation label is changed.
|
||||||
|
$( 'body' ).on( 'input', '.edit-menu-item-title', function(e) {
|
||||||
|
var input = $( e.currentTarget ), title, titleEl;
|
||||||
|
title = input.val();
|
||||||
|
titleEl = input.closest( '.menu-item' ).find( '.menu-item-title' );
|
||||||
|
// Don't update to empty title.
|
||||||
|
if ( title ) {
|
||||||
|
titleEl.text( title ).removeClass( 'no-title' );
|
||||||
|
} else {
|
||||||
|
titleEl.text( navMenuL10n.untitled ).addClass( 'no-title' );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
},
|
||||||
|
|
||||||
initToggles : function() {
|
initToggles : function() {
|
||||||
// init postboxes
|
// init postboxes
|
||||||
postboxes.add_postbox_toggles('nav-menus');
|
postboxes.add_postbox_toggles('nav-menus');
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -530,7 +530,8 @@ function wp_default_scripts( &$scripts ) {
|
||||||
did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
|
did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
|
||||||
'noResultsFound' => _x('No results found.', 'search results'),
|
'noResultsFound' => _x('No results found.', 'search results'),
|
||||||
'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
|
'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
|
||||||
'saveAlert' => __('The changes you made will be lost if you navigate away from this page.')
|
'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
|
||||||
|
'untitled' => _x('(no label)', 'missing menu item navigation label')
|
||||||
) );
|
) );
|
||||||
|
|
||||||
$scripts->add( 'custom-header', "/wp-admin/js/custom-header.js", array( 'jquery-masonry' ), false, 1 );
|
$scripts->add( 'custom-header', "/wp-admin/js/custom-header.js", array( 'jquery-masonry' ), false, 1 );
|
||||||
|
|
Loading…
Reference in New Issue