Make WordPress Core

Changeset 29189


Ignore:
Timestamp:
07/16/2014 04:13:47 PM (11 years ago)
Author:
wonderboymusic
Message:

Cleanup after [29179]:

  • Cleanup players when the editor is hidden - window scope is unique to each frame
  • Add the editor body class to each iframe sandbox
  • Remove unneeded code from wp-mediaelement.js

See #28905.

Location:
trunk/src/wp-includes/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/mce-view.js

    r29187 r29189  
    131131                    node = $( node ).find( '.wpview-content' )[0];
    132132
    133                     node.innerHTML = '';
     133                    if ( node ) {
     134                        node.innerHTML = '';
     135                    }
    134136
    135137                    iframe = dom.add( node, 'iframe', {
     
    153155                                '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
    154156                            '</head>' +
    155                             '<body style="padding: 0; margin: 0;" class="' + /* editor.getBody().className + */ '">' +
     157                            '<body data-context="iframe-sandbox" style="padding: 0; margin: 0;" class="' + editor.getBody().className + '">' +
    156158                                content +
    157159                            '</body>' +
     
    508510                this.fetching = false;
    509511
    510                 _.bindAll( this, 'createIframe', 'setNode', 'fetch' );
     512                _.bindAll( this, 'createIframe', 'setNode', 'fetch', 'pausePlayers' );
    511513                $( this ).on( 'ready', this.setNode );
    512514            },
    513515
    514             setNode: function () {
     516            setNode: function ( event, editor, node ) {
     517                this.node = node;
     518                editor.on( 'hide', this.pausePlayers );
     519
    515520                if ( this.parsed ) {
    516521                    this.createIframe( this.parsed );
     
    565570                }
    566571                return this.parsed;
     572            },
     573
     574            pausePlayers: function() {
     575                var p, win = $( 'iframe', this.node ).get(0).contentWindow;
     576                if ( win.mejs ) {
     577                    for ( p in win.mejs.players ) {
     578                        win.mejs.players[p].pause();
     579                        win.mejs.players[p].remove();
     580                    }
     581                }
    567582            }
    568583        },
  • trunk/src/wp-includes/js/mediaelement/wp-mediaelement.js

    r28370 r29189  
    77    $(function () {
    88        var settings = {};
    9 
    10         if ( $( document.body ).hasClass( 'mce-content-body' ) ) {
    11             return;
    12         }
    139
    1410        if ( typeof _wpmejsSettings !== 'undefined' ) {
Note: See TracChangeset for help on using the changeset viewer.