Widgets: Add missing open
class for expanded widgets in Customizer; utilize open
class for expansion detection in Text and Media widgets.
Fixes #41625. git-svn-id: https://develop.svn.wordpress.org/trunk@41249 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8b6b45c96b
commit
21f8256a27
@ -1400,6 +1400,7 @@
|
|||||||
complete = function() {
|
complete = function() {
|
||||||
self.container.removeClass( 'expanding' );
|
self.container.removeClass( 'expanding' );
|
||||||
self.container.addClass( 'expanded' );
|
self.container.addClass( 'expanded' );
|
||||||
|
$widget.addClass( 'open' );
|
||||||
$toggleBtn.attr( 'aria-expanded', 'true' );
|
$toggleBtn.attr( 'aria-expanded', 'true' );
|
||||||
self.container.trigger( 'expanded' );
|
self.container.trigger( 'expanded' );
|
||||||
};
|
};
|
||||||
@ -1433,6 +1434,7 @@
|
|||||||
complete = function() {
|
complete = function() {
|
||||||
self.container.removeClass( 'collapsing' );
|
self.container.removeClass( 'collapsing' );
|
||||||
self.container.removeClass( 'expanded' );
|
self.container.removeClass( 'expanded' );
|
||||||
|
$widget.removeClass( 'open' );
|
||||||
$toggleBtn.attr( 'aria-expanded', 'false' );
|
$toggleBtn.attr( 'aria-expanded', 'false' );
|
||||||
self.container.trigger( 'collapsed' );
|
self.container.trigger( 'collapsed' );
|
||||||
};
|
};
|
||||||
|
@ -1030,7 +1030,7 @@ wp.mediaWidgets = ( function( $ ) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
|
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
|
||||||
var fieldContainer, syncContainer, widgetForm, idBase, ControlConstructor, ModelConstructor, modelAttributes, widgetControl, widgetModel, widgetId, widgetInside, animatedCheckDelay = 50, renderWhenAnimationDone;
|
var fieldContainer, syncContainer, widgetForm, idBase, ControlConstructor, ModelConstructor, modelAttributes, widgetControl, widgetModel, widgetId, animatedCheckDelay = 50, renderWhenAnimationDone;
|
||||||
widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); // Note: '.form' appears in the customizer, whereas 'form' on the widgets admin screen.
|
widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); // Note: '.form' appears in the customizer, whereas 'form' on the widgets admin screen.
|
||||||
idBase = widgetForm.find( '> .id_base' ).val();
|
idBase = widgetForm.find( '> .id_base' ).val();
|
||||||
widgetId = widgetForm.find( '> .widget-id' ).val();
|
widgetId = widgetForm.find( '> .widget-id' ).val();
|
||||||
@ -1088,9 +1088,8 @@ wp.mediaWidgets = ( function( $ ) {
|
|||||||
* This ensures that the container's dimensions are fixed so that ME.js
|
* This ensures that the container's dimensions are fixed so that ME.js
|
||||||
* can initialize with the proper dimensions.
|
* can initialize with the proper dimensions.
|
||||||
*/
|
*/
|
||||||
widgetInside = widgetContainer.parent();
|
|
||||||
renderWhenAnimationDone = function() {
|
renderWhenAnimationDone = function() {
|
||||||
if ( widgetInside.is( ':animated' ) ) {
|
if ( ! widgetContainer.hasClass( 'open' ) ) {
|
||||||
setTimeout( renderWhenAnimationDone, animatedCheckDelay );
|
setTimeout( renderWhenAnimationDone, animatedCheckDelay );
|
||||||
} else {
|
} else {
|
||||||
widgetControl.render();
|
widgetControl.render();
|
||||||
|
@ -354,7 +354,7 @@ wp.textWidgets = ( function( $ ) {
|
|||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
|
component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
|
||||||
var widgetForm, idBase, widgetControl, widgetId, animatedCheckDelay = 50, widgetInside, renderWhenAnimationDone, fieldContainer, syncContainer;
|
var widgetForm, idBase, widgetControl, widgetId, animatedCheckDelay = 50, renderWhenAnimationDone, fieldContainer, syncContainer;
|
||||||
widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); // Note: '.form' appears in the customizer, whereas 'form' on the widgets admin screen.
|
widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); // Note: '.form' appears in the customizer, whereas 'form' on the widgets admin screen.
|
||||||
|
|
||||||
idBase = widgetForm.find( '> .id_base' ).val();
|
idBase = widgetForm.find( '> .id_base' ).val();
|
||||||
@ -401,9 +401,8 @@ wp.textWidgets = ( function( $ ) {
|
|||||||
* This ensures that the textarea is visible and an iframe can be embedded
|
* This ensures that the textarea is visible and an iframe can be embedded
|
||||||
* with TinyMCE being able to set contenteditable on it.
|
* with TinyMCE being able to set contenteditable on it.
|
||||||
*/
|
*/
|
||||||
widgetInside = widgetContainer.parent();
|
|
||||||
renderWhenAnimationDone = function() {
|
renderWhenAnimationDone = function() {
|
||||||
if ( widgetInside.is( ':animated' ) ) {
|
if ( ! widgetContainer.hasClass( 'open' ) ) {
|
||||||
setTimeout( renderWhenAnimationDone, animatedCheckDelay );
|
setTimeout( renderWhenAnimationDone, animatedCheckDelay );
|
||||||
} else {
|
} else {
|
||||||
widgetControl.initializeEditor();
|
widgetControl.initializeEditor();
|
||||||
|
Loading…
Reference in New Issue
Block a user