Make WordPress Core

Ticket #40750: 40750.0.diff

File 40750.0.diff, 2.1 KB (added by westonruter, 7 years ago)
  • src/wp-admin/js/widgets/media-video-widget.js

    diff --git src/wp-admin/js/widgets/media-video-widget.js src/wp-admin/js/widgets/media-video-widget.js
    index 8c5563164d..547c4efc48 100644
     
    180180                                is_hosted_embed: isHostedEmbed,
    181181                                error: error
    182182                        } ) );
     183                        wp.mediaelement.initialize();
    183184                },
    184185
    185186                /**
  • src/wp-admin/js/widgets/media-widgets.js

    diff --git src/wp-admin/js/widgets/media-widgets.js src/wp-admin/js/widgets/media-widgets.js
    index c45e9ee954..1985e7abf0 100644
    wp.mediaWidgets = ( function( $ ) { 
    10001000         * @returns {void}
    10011001         */
    10021002        component.handleWidgetAdded = function handleWidgetAdded( event, widgetContainer ) {
    1003                 var widgetContent, controlContainer, widgetForm, idBase, ControlConstructor, ModelConstructor, modelAttributes, widgetControl, widgetModel, widgetId;
     1003                var widgetContent, controlContainer, widgetForm, idBase, ControlConstructor, ModelConstructor, modelAttributes, widgetControl, widgetModel, widgetId, widgetInside, animatedCheckDelay = 50, renderWhenAnimationDone;
    10041004                widgetForm = widgetContainer.find( '> .widget-inside > .form, > .widget-inside > form' ); // Note: '.form' appears in the customizer, whereas 'form' on the widgets admin screen.
    10051005                widgetContent = widgetForm.find( '> .widget-content' );
    10061006                idBase = widgetForm.find( '> .id_base' ).val();
    wp.mediaWidgets = ( function( $ ) { 
    10501050                        el: controlContainer,
    10511051                        model: widgetModel
    10521052                });
    1053                 widgetControl.render();
     1053
     1054                /*
     1055                 * Render the widget once the widget parent's container finishes animating,
     1056                 * as the widget-added event fires with a slideDown of the container.
     1057                 * This ensures that the container's dimensions are fixed so that ME.js
     1058                 * can initialize with the proper dimensions.
     1059                 */
     1060                widgetInside = widgetContainer.parent();
     1061                renderWhenAnimationDone = function() {
     1062                        if ( widgetInside.is( ':animated' ) ) {
     1063                                setTimeout( renderWhenAnimationDone, animatedCheckDelay );
     1064                        } else {
     1065                                widgetControl.render();
     1066                        }
     1067                };
    10541068
    10551069                /*
    10561070                 * Note that the model and control currently won't ever get garbage-collected