diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js index 9454f2850d..4754895726 100644 --- a/src/wp-includes/js/mce-view.js +++ b/src/wp-includes/js/mce-view.js @@ -130,7 +130,9 @@ window.wp = window.wp || {}; node = $( node ).find( '.wpview-content' )[0]; - node.innerHTML = ''; + if ( node ) { + node.innerHTML = ''; + } iframe = dom.add( node, 'iframe', { src: tinymce.Env.ie ? 'javascript:""' : '', @@ -152,7 +154,7 @@ window.wp = window.wp || {}; '
' + '' + '' + - '' + + '' + content + '' + '' @@ -507,11 +509,14 @@ window.wp = window.wp || {}; this.shortcode = options.shortcode; this.fetching = false; - _.bindAll( this, 'createIframe', 'setNode', 'fetch' ); + _.bindAll( this, 'createIframe', 'setNode', 'fetch', 'pausePlayers' ); $( this ).on( 'ready', this.setNode ); }, - setNode: function () { + setNode: function ( event, editor, node ) { + this.node = node; + editor.on( 'hide', this.pausePlayers ); + if ( this.parsed ) { this.createIframe( this.parsed ); } else if ( ! this.fetching ) { @@ -564,6 +569,16 @@ window.wp = window.wp || {}; return ' '; } return this.parsed; + }, + + pausePlayers: function() { + var p, win = $( 'iframe', this.node ).get(0).contentWindow; + if ( win.mejs ) { + for ( p in win.mejs.players ) { + win.mejs.players[p].pause(); + win.mejs.players[p].remove(); + } + } } }, diff --git a/src/wp-includes/js/mediaelement/wp-mediaelement.js b/src/wp-includes/js/mediaelement/wp-mediaelement.js index 2caa81592b..6e20b90058 100644 --- a/src/wp-includes/js/mediaelement/wp-mediaelement.js +++ b/src/wp-includes/js/mediaelement/wp-mediaelement.js @@ -7,10 +7,6 @@ $(function () { var settings = {}; - if ( $( document.body ).hasClass( 'mce-content-body' ) ) { - return; - } - if ( typeof _wpmejsSettings !== 'undefined' ) { settings = _wpmejsSettings; }