Cleanup after [29179]:

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

Props avryl.
See #28905.


git-svn-id: https://develop.svn.wordpress.org/trunk@29193 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-07-16 19:31:30 +00:00
parent 67c5474701
commit aa10b9f67b

View File

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