Cleanup after [29179]:

Don't attach nodes to the view instance and check if the iframe still exists before resizing.

Props avryl.
See #28905.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-07-16 19:32:16 +00:00
parent 100e5ca40b
commit 69986d87a7
2 changed files with 20 additions and 16 deletions

View File

@ -162,7 +162,8 @@ window.wp = window.wp || {};
iframeDoc.close();
resize = function() {
$( iframe ).height( $( iframeDoc.body ).height() );
// Make sure the iframe still exists.
iframe.contentWindow && $( iframe ).height( $( iframeDoc.body ).height() );
};
if ( MutationObserver ) {
@ -515,10 +516,7 @@ window.wp = window.wp || {};
$( document ).on( 'media:edit', this.pausePlayers );
},
setNode: function ( event, editor, node ) {
if ( node ) {
this.node = node;
}
setNode: function ( event, editor ) {
editor.on( 'hide', this.pausePlayers );
if ( this.parsed ) {
@ -576,21 +574,27 @@ window.wp = window.wp || {};
},
pausePlayers: function() {
var p, win = $( 'iframe', this.node ).get(0).contentWindow;
if ( win && win.mejs ) {
for ( p in win.mejs.players ) {
win.mejs.players[p].pause();
this.getNodes( function( editor, node ) {
var p, win = $( 'iframe', node ).get(0).contentWindow;
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();
this.getNodes( function( editor, node ) {
var p, win = $( 'iframe', node ).get(0).contentWindow;
if ( win && win.mejs ) {
for ( p in win.mejs.players ) {
win.mejs.players[p].remove();
}
}
}
});
},
unbind: function() {

File diff suppressed because one or more lines are too long