Cleanup after [29179]:
* Cleanup players when the editor is hidden - window scope is unique to each frame * Add the editor body class to each iframe sandbox * Remove unneeded code from `wp-mediaelement.js` See #28905. Built from https://develop.svn.wordpress.org/trunk@29189 git-svn-id: http://core.svn.wordpress.org/trunk@28973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4bf7cdd49b
commit
75d3fe3e65
|
@ -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 || {};
|
|||
'<head>' +
|
||||
'<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />' +
|
||||
'</head>' +
|
||||
'<body style="padding: 0; margin: 0;" class="' + /* editor.getBody().className + */ '">' +
|
||||
'<body data-context="iframe-sandbox" style="padding: 0; margin: 0;" class="' + editor.getBody().className + '">' +
|
||||
content +
|
||||
'</body>' +
|
||||
'</html>'
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -7,10 +7,6 @@
|
|||
$(function () {
|
||||
var settings = {};
|
||||
|
||||
if ( $( document.body ).hasClass( 'mce-content-body' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( typeof _wpmejsSettings !== 'undefined' ) {
|
||||
settings = _wpmejsSettings;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue