Ticket #22237: 22237.4.diff
File 22237.4.diff, 4.8 KB (added by , 9 years ago) |
---|
-
src/wp-admin/js/customize-controls.js
diff --git src/wp-admin/js/customize-controls.js src/wp-admin/js/customize-controls.js index 1e134bd..ef01674 100644
3647 3647 overlay.toggleClass( 'collapsed' ).toggleClass( 'expanded' ); 3648 3648 }); 3649 3649 3650 // Keyboard shortcuts - esc to exit section/panel. 3651 $( 'body' ).on( 'keydown', function( event ) { 3652 var collapsedObject, expandedControls = [], expandedSections = [], expandedPanels = []; 3653 3654 if ( 27 !== event.which ) { // Esc. 3655 return; 3656 } 3657 3658 // Check for expanded expandable controls (e.g. widgets and nav menus items), sections, and panels. 3659 api.control.each( function( control ) { 3660 if ( control.expanded && control.expanded() && _.isFunction( control.collapse ) ) { 3661 expandedControls.push( control ); 3662 } 3663 }); 3664 api.section.each( function( section ) { 3665 if ( section.expanded() ) { 3666 expandedSections.push( section ); 3667 } 3668 }); 3669 api.panel.each( function( panel ) { 3670 if ( panel.expanded() ) { 3671 expandedPanels.push( panel ); 3672 } 3673 }); 3674 3675 // Skip collapsing expanded controls if there are no expanded sections. 3676 if ( expandedControls.length > 0 && 0 === expandedSections.length ) { 3677 expandedControls.length = 0; 3678 } 3679 3680 // Collapse the most granular expanded object. 3681 collapsedObject = expandedControls[0] || expandedSections[0] || expandedPanels[0]; 3682 if ( collapsedObject ) { 3683 collapsedObject.collapse(); 3684 event.preventDefault(); 3685 } 3686 }); 3687 3650 3688 $( '.customize-controls-preview-toggle' ).on( 'click', function() { 3651 3689 overlay.toggleClass( 'preview-only' ); 3652 3690 }); -
src/wp-admin/js/customize-nav-menus.js
diff --git src/wp-admin/js/customize-nav-menus.js src/wp-admin/js/customize-nav-menus.js index 7f09253..d27f57c 100644
993 993 */ 994 994 initialize: function( id, options ) { 995 995 var control = this; 996 control.expanded = new api.Value( false ); 997 control.expandedArgumentsQueue = []; 998 control.expanded.bind( function( expanded ) { 999 var args = control.expandedArgumentsQueue.shift(); 1000 args = $.extend( {}, control.defaultExpandedArguments, args ); 1001 control.onChangeExpanded( expanded, args ); 1002 }); 996 1003 api.Control.prototype.initialize.call( control, id, options ); 997 1004 control.active.validate = function() { 998 1005 var value, section = api.section( control.section() ); … … 1370 1377 }, 1371 1378 1372 1379 /** 1380 * @since 4.6.0 1381 * 1382 * @param {Boolean} expanded 1383 * @param {Object} [params] 1384 * @returns {Boolean} false if state already applied 1385 */ 1386 _toggleExpanded: api.Section.prototype._toggleExpanded, 1387 1388 /** 1389 * @since 4.6.0 1390 * 1391 * @param {Object} [params] 1392 * @returns {Boolean} false if already expanded 1393 */ 1394 expand: api.Section.prototype.expand, 1395 1396 /** 1373 1397 * Expand the menu item form control. 1374 1398 * 1375 1399 * @since 4.5.0 Added params.completeCallback. … … 1378 1402 * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating. 1379 1403 */ 1380 1404 expandForm: function( params ) { 1381 this. toggleForm( true,params );1405 this.expand( params ); 1382 1406 }, 1383 1407 1384 1408 /** 1409 * @since 4.6.0 1410 * 1411 * @param {Object} [params] 1412 * @returns {Boolean} false if already collapsed 1413 */ 1414 collapse: api.Section.prototype.collapse, 1415 1416 /** 1385 1417 * Collapse the menu item form control. 1386 1418 * 1387 1419 * @since 4.5.0 Added params.completeCallback. … … 1390 1422 * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating. 1391 1423 */ 1392 1424 collapseForm: function( params ) { 1393 this. toggleForm( false,params );1425 this.collapse( params ); 1394 1426 }, 1395 1427 1396 1428 /** 1397 1429 * Expand or collapse the menu item control. 1398 1430 * 1431 * @deprecated this is poor naming, and it is better to directly set control.expanded( showOrHide ) 1399 1432 * @since 4.5.0 Added params.completeCallback. 1400 1433 * 1401 1434 * @param {boolean} [showOrHide] - If not supplied, will be inverse of current visibility … … 1403 1436 * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating. 1404 1437 */ 1405 1438 toggleForm: function( showOrHide, params ) { 1439 if ( typeof showOrHide === 'undefined' ) { 1440 showOrHide = ! this.expanded(); 1441 } 1442 if ( showOrHide ) { 1443 this.expand( params ); 1444 } else { 1445 this.collapse( params ); 1446 } 1447 }, 1448 1449 /** 1450 * Expand or collapse the menu item control. 1451 * 1452 * @since 4.6.0 1453 * @param {boolean} [showOrHide] - If not supplied, will be inverse of current visibility 1454 * @param {Object} [params] - Optional params. 1455 * @param {Function} [params.completeCallback] - Function to call when the form toggle has finished animating. 1456 */ 1457 onChangeExpanded: function( showOrHide, params ) { 1406 1458 var self = this, $menuitem, $inside, complete; 1407 1459 1408 1460 $menuitem = this.container;