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:
parent
227a80eba3
commit
94e8a9cfa0
|
@ -125,6 +125,8 @@
|
||||||
} else {
|
} else {
|
||||||
params.completeCallback = focus;
|
params.completeCallback = focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
api.state( 'paneVisible' ).set( true );
|
||||||
if ( construct.expand ) {
|
if ( construct.expand ) {
|
||||||
construct.expand( params );
|
construct.expand( params );
|
||||||
} else {
|
} else {
|
||||||
|
@ -441,6 +443,7 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
api.state( 'paneVisible' ).set( true );
|
||||||
params.completeCallback = function() {
|
params.completeCallback = function() {
|
||||||
if ( previousCompleteCallback ) {
|
if ( previousCompleteCallback ) {
|
||||||
previousCompleteCallback.apply( instance, arguments );
|
previousCompleteCallback.apply( instance, arguments );
|
||||||
|
@ -3912,7 +3915,8 @@
|
||||||
var state = new api.Values(),
|
var state = new api.Values(),
|
||||||
saved = state.create( 'saved' ),
|
saved = state.create( 'saved' ),
|
||||||
activated = state.create( 'activated' ),
|
activated = state.create( 'activated' ),
|
||||||
processing = state.create( 'processing' );
|
processing = state.create( 'processing' ),
|
||||||
|
paneVisible = state.create( 'paneVisible' );
|
||||||
|
|
||||||
state.bind( 'change', function() {
|
state.bind( 'change', function() {
|
||||||
if ( ! activated() ) {
|
if ( ! activated() ) {
|
||||||
|
@ -3933,6 +3937,7 @@
|
||||||
saved( true );
|
saved( true );
|
||||||
activated( api.settings.theme.active );
|
activated( api.settings.theme.active );
|
||||||
processing( 0 );
|
processing( 0 );
|
||||||
|
paneVisible( true );
|
||||||
|
|
||||||
api.bind( 'change', function() {
|
api.bind( 'change', function() {
|
||||||
state('saved').set( false );
|
state('saved').set( false );
|
||||||
|
@ -3974,13 +3979,18 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
$( '.collapse-sidebar' ).on( 'click', function() {
|
$( '.collapse-sidebar' ).on( 'click', function() {
|
||||||
if ( 'true' === $( this ).attr( 'aria-expanded' ) ) {
|
api.state( 'paneVisible' ).set( ! api.state( 'paneVisible' ).get() );
|
||||||
$( this ).attr({ 'aria-expanded': 'false', 'aria-label': api.l10n.expandSidebar });
|
});
|
||||||
} else {
|
|
||||||
$( this ).attr({ 'aria-expanded': 'true', 'aria-label': api.l10n.collapseSidebar });
|
|
||||||
}
|
|
||||||
|
|
||||||
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.
|
// Keyboard shortcuts - esc to exit section/panel.
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue