Customize: Introduce paneVisible state and ensure pane is visible when a construct is expanded (or focused).

Fixes issue whereby a user would see nothing happen if the pane is collapsed while they shift-click to edit an element in the preview.

Props curdin, celloexpressions, westonruter.
See #27403.
Fixes #36678.

Built from https://develop.svn.wordpress.org/trunk@38492


git-svn-id: http://core.svn.wordpress.org/trunk@38433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-09-01 05:55:27 +00:00
parent 227a80eba3
commit 94e8a9cfa0
3 changed files with 20 additions and 10 deletions

View File

@ -125,6 +125,8 @@
} else {
params.completeCallback = focus;
}
api.state( 'paneVisible' ).set( true );
if ( construct.expand ) {
construct.expand( params );
} else {
@ -441,6 +443,7 @@
return false;
}
api.state( 'paneVisible' ).set( true );
params.completeCallback = function() {
if ( previousCompleteCallback ) {
previousCompleteCallback.apply( instance, arguments );
@ -3912,7 +3915,8 @@
var state = new api.Values(),
saved = state.create( 'saved' ),
activated = state.create( 'activated' ),
processing = state.create( 'processing' );
processing = state.create( 'processing' ),
paneVisible = state.create( 'paneVisible' );
state.bind( 'change', function() {
if ( ! activated() ) {
@ -3933,6 +3937,7 @@
saved( true );
activated( api.settings.theme.active );
processing( 0 );
paneVisible( true );
api.bind( 'change', function() {
state('saved').set( false );
@ -3974,13 +3979,18 @@
});
$( '.collapse-sidebar' ).on( 'click', function() {
if ( 'true' === $( this ).attr( 'aria-expanded' ) ) {
$( this ).attr({ 'aria-expanded': 'false', 'aria-label': api.l10n.expandSidebar });
} else {
$( this ).attr({ 'aria-expanded': 'true', 'aria-label': api.l10n.collapseSidebar });
}
api.state( 'paneVisible' ).set( ! api.state( 'paneVisible' ).get() );
});
overlay.toggleClass( 'collapsed' ).toggleClass( 'expanded' );
api.state( 'paneVisible' ).bind( function( paneVisible ) {
overlay.toggleClass( 'expanded', paneVisible );
overlay.toggleClass( 'collapsed', ! paneVisible );
if ( ! paneVisible ) {
$( '.collapse-sidebar' ).attr({ 'aria-expanded': 'false', 'aria-label': api.l10n.expandSidebar });
} else {
$( '.collapse-sidebar' ).attr({ 'aria-expanded': 'true', 'aria-label': api.l10n.collapseSidebar });
}
});
// Keyboard shortcuts - esc to exit section/panel.

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.7-alpha-38491';
$wp_version = '4.7-alpha-38492';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.