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.

Built from https://develop.svn.wordpress.org/trunk@29191


git-svn-id: http://core.svn.wordpress.org/trunk@28975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-07-16 18:19:14 +00:00
parent 7f7c3fb54f
commit cd497224a3
2 changed files with 23 additions and 6 deletions

View File

@ -129,10 +129,10 @@ window.wp = window.wp || {};
iframe, iframeDoc, i, resize;
node = $( node ).find( '.wpview-content' )[0];
if ( node ) {
node.innerHTML = '';
if ( ! node ) {
return;
}
node.innerHTML = '';
iframe = dom.add( node, 'iframe', {
src: tinymce.Env.ie ? 'javascript:""' : '',
@ -511,10 +511,14 @@ window.wp = window.wp || {};
_.bindAll( this, 'createIframe', 'setNode', 'fetch', 'pausePlayers' );
$( this ).on( 'ready', this.setNode );
$( document ).on( 'media:edit', this.pausePlayers );
},
setNode: function ( event, editor, node ) {
if ( node ) {
this.node = node;
}
editor.on( 'hide', this.pausePlayers );
if ( this.parsed ) {
@ -573,12 +577,25 @@ window.wp = window.wp || {};
pausePlayers: function() {
var p, win = $( 'iframe', this.node ).get(0).contentWindow;
if ( win.mejs ) {
if ( win && win.mejs ) {
for ( p in win.mejs.players ) {
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();
}
}
},
unbind: function() {
this.pausePlayers();
this.unsetPlayers();
}
},

File diff suppressed because one or more lines are too long