Cleanup after [29179]:
* Pause players when media is edited via modal * Remove players on unind * Account for failure when an empty node is passed to an `mce.view.View` See #28905. git-svn-id: https://develop.svn.wordpress.org/trunk@29191 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
fa4ed6e062
commit
72c8cf3233
@ -129,10 +129,10 @@ window.wp = window.wp || {};
|
|||||||
iframe, iframeDoc, i, resize;
|
iframe, iframeDoc, i, resize;
|
||||||
|
|
||||||
node = $( node ).find( '.wpview-content' )[0];
|
node = $( node ).find( '.wpview-content' )[0];
|
||||||
|
if ( ! node ) {
|
||||||
if ( node ) {
|
return;
|
||||||
node.innerHTML = '';
|
|
||||||
}
|
}
|
||||||
|
node.innerHTML = '';
|
||||||
|
|
||||||
iframe = dom.add( node, 'iframe', {
|
iframe = dom.add( node, 'iframe', {
|
||||||
src: tinymce.Env.ie ? 'javascript:""' : '',
|
src: tinymce.Env.ie ? 'javascript:""' : '',
|
||||||
@ -511,10 +511,14 @@ window.wp = window.wp || {};
|
|||||||
|
|
||||||
_.bindAll( this, 'createIframe', 'setNode', 'fetch', 'pausePlayers' );
|
_.bindAll( this, 'createIframe', 'setNode', 'fetch', 'pausePlayers' );
|
||||||
$( this ).on( 'ready', this.setNode );
|
$( this ).on( 'ready', this.setNode );
|
||||||
|
|
||||||
|
$( document ).on( 'media:edit', this.pausePlayers );
|
||||||
},
|
},
|
||||||
|
|
||||||
setNode: function ( event, editor, node ) {
|
setNode: function ( event, editor, node ) {
|
||||||
|
if ( node ) {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
|
}
|
||||||
editor.on( 'hide', this.pausePlayers );
|
editor.on( 'hide', this.pausePlayers );
|
||||||
|
|
||||||
if ( this.parsed ) {
|
if ( this.parsed ) {
|
||||||
@ -573,12 +577,25 @@ window.wp = window.wp || {};
|
|||||||
|
|
||||||
pausePlayers: function() {
|
pausePlayers: function() {
|
||||||
var p, win = $( 'iframe', this.node ).get(0).contentWindow;
|
var p, win = $( 'iframe', this.node ).get(0).contentWindow;
|
||||||
if ( win.mejs ) {
|
if ( win && win.mejs ) {
|
||||||
for ( p in win.mejs.players ) {
|
for ( p in win.mejs.players ) {
|
||||||
win.mejs.players[p].pause();
|
win.mejs.players[p].pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
unsetPlayers: function() {
|
||||||
|
var p, win = $( 'iframe', this.node ).get(0).contentWindow;
|
||||||
|
if ( win && win.mejs ) {
|
||||||
|
for ( p in win.mejs.players ) {
|
||||||
win.mejs.players[p].remove();
|
win.mejs.players[p].remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
unbind: function() {
|
||||||
|
this.pausePlayers();
|
||||||
|
this.unsetPlayers();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user