Make WordPress Core

Ticket #27971: 27971.diff

File 27971.diff, 2.5 KB (added by wonderboymusic, 11 years ago)
  • src/wp-includes/js/mce-view.js

     
    371371                                self = this,
    372372                                frame, data, callback;
    373373
    374                         wp.media.mixin.pauseAllPlayers();
     374                        $( document ).trigger( 'media:edit' );
    375375
    376376                        data = window.decodeURIComponent( $( node ).attr('data-wpview-text') );
    377377                        frame = media.edit( data );
     
    407407                initialize: function( options ) {
    408408                        this.players = [];
    409409                        this.shortcode = options.shortcode;
    410                         _.bindAll( this, 'setPlayer' );
    411                         $(this).on( 'ready', this.setPlayer );
     410                        _.bindAll( this, 'setPlayer', 'pausePlayers' );
     411                        $( this ).on( 'ready', this.setPlayer );
     412                        $( 'body' ).on( 'click', '.wp-switch-editor', this.pausePlayers );
     413                        $( document ).on( 'media:edit', this.pausePlayers );
    412414                },
    413415
    414416                /**
     
    524526                        this.data = {};
    525527                        this.attachments = [];
    526528                        this.shortcode = options.shortcode;
     529
     530                        $( 'body' ).on( 'click', '.wp-switch-editor', this.pausePlayers );
     531                        $( document ).on( 'media:edit', this.pausePlayers );
     532
    527533                        this.fetch();
    528534                },
    529535
     
    687693                        },
    688694                        unbind: function() {
    689695                                var self = this;
    690                                 this.pauseAllPlayers();
    691696                                _.each( this.players, function ( player ) {
     697                                        player.pause();
    692698                                        self.removePlayer( player );
    693699                                } );
    694700                                this.players = [];
  • src/wp-includes/js/media-audiovideo.js

     
    2727                },
    2828
    2929                /**
     30                 * Pauses the current object's instances of MediaElementPlayer
     31                 */
     32                pausePlayers: function() {
     33                        _.each( this.players, function (player) {
     34                                player.pause();
     35                        } );
     36                },
     37
     38                /**
    3039                 * Utility to identify the user's browser
    3140                 */
    3241                ua: {
     
    168177                 */
    169178                unsetPlayers : function() {
    170179                        if ( this.players && this.players.length ) {
    171                                 wp.media.mixin.pauseAllPlayers();
    172180                                _.each( this.players, function (player) {
     181                                        player.pause();
    173182                                        wp.media.mixin.removePlayer( player );
    174183                                } );
    175184                                this.players = [];
     
    911920         */
    912921        function init() {
    913922                $(document.body)
    914                         .on( 'click', '.wp-switch-editor', wp.media.mixin.pauseAllPlayers )
    915923                        .on( 'click', '.add-media-source', function( e ) {
    916924                                media.frame.lastMime = $( e.currentTarget ).data( 'mime' );
    917925                                media.frame.setState( 'add-' + media.frame.defaults.id + '-source' );