Make WordPress Core

Ticket #42495: 42495.1.diff

File 42495.1.diff, 2.9 KB (added by bpayton, 7 years ago)

Same updates but new patch to be SVN friendly

  • src/wp-includes/js/customize-selective-refresh.js

    diff --git src/wp-includes/js/customize-selective-refresh.js src/wp-includes/js/customize-selective-refresh.js
    index b1169eb277..a3d71f76d1 100644
    wp.customize.selectiveRefresh = ( function( $, api ) { 
    488488                                wp.mediaelement.initialize();
    489489                        }
    490490
     491                        if ( wp.playlist ) {
     492                                wp.playlist.initialize();
     493                        }
     494
    491495                        /**
    492496                         * Announce when a partial's placement has been rendered so that dynamic elements can be re-built.
    493497                         */
  • src/wp-includes/js/mediaelement/wp-playlist.js

    diff --git src/wp-includes/js/mediaelement/wp-playlist.js src/wp-includes/js/mediaelement/wp-playlist.js
    index 19cab125ba..7d46b201e0 100644
     
    33(function ($, _, Backbone) {
    44        'use strict';
    55
     6        window.wp = window.wp || {};
     7
    68        var WPPlaylistView = Backbone.View.extend(/** @lends WPPlaylistView.prototype */{
    79                /**
    810                 * @constructs
     
    168170                }
    169171        });
    170172
    171     $(document).ready(function () {
    172                 $('.wp-playlist').each( function() {
    173                         return new WPPlaylistView({ el: this });
     173        function initialize() {
     174                // Only initialize new playlists
     175                $( '.wp-playlist:not(:has(.mejs-container))' ).each( function() {
     176                        new WPPlaylistView( { el: this } );
    174177                } );
    175     });
     178        }
     179
     180        window.wp.playlist = {
     181                initialize: initialize
     182        };
     183
     184        $(document).ready( initialize );
    176185
    177186        window.WPPlaylistView = WPPlaylistView;
    178187
  • src/wp-includes/widgets/class-wp-widget-text.php

    diff --git src/wp-includes/widgets/class-wp-widget-text.php src/wp-includes/widgets/class-wp-widget-text.php
    index dc94978cd4..f42b0ca20e 100644
    class WP_Widget_Text extends WP_Widget { 
    5757
    5858                wp_add_inline_script( 'text-widgets', sprintf( 'wp.textWidgets.idBases.push( %s );', wp_json_encode( $this->id_base ) ) );
    5959
     60                if ( $this->is_preview() ) {
     61                        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) );
     62                }
     63
    6064                // Note that the widgets component in the customizer will also do the 'admin_print_scripts-widgets.php' action in WP_Customize_Widgets::print_scripts().
    6165                add_action( 'admin_print_scripts-widgets.php', array( $this, 'enqueue_admin_scripts' ) );
    6266
    class WP_Widget_Text extends WP_Widget { 
    393397                return $instance;
    394398        }
    395399
     400        /**
     401         * Enqueue preview scripts.
     402         *
     403         * These scripts normally are enqueued just-in-time when a playlist shortcode is used.
     404         * However, in the customizer, a playlist shortcode may be used in a text widget and
     405         * dynamically added via selective refresh, so it is important to unconditionally enqueue them.
     406         *
     407         * @since 4.9.2
     408         */
     409        public function enqueue_preview_scripts() {
     410                require_once( dirname( dirname( __FILE__ ) ) . '/media.php' );
     411
     412                wp_playlist_scripts( 'audio' );
     413                wp_playlist_scripts( 'video' );
     414        }
     415
    396416        /**
    397417         * Loads the required scripts and styles for the widget control.
    398418         *