TinyMCE: improve setting of the sandboxing iframe inside a view.
Props mattheu, iseulde. Fixes #31412. Built from https://develop.svn.wordpress.org/trunk@31740 git-svn-id: http://core.svn.wordpress.org/trunk@31721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1581ca7092
commit
b5f1514b54
|
@ -433,9 +433,9 @@ window.wp = window.wp || {};
|
|||
*/
|
||||
setContent: function( content, callback, rendered ) {
|
||||
if ( _.isObject( content ) && content.body.indexOf( '<script' ) !== -1 ) {
|
||||
this.setIframes( content.head, content.body, callback, rendered );
|
||||
this.setIframes( content.head || '', content.body, callback, rendered );
|
||||
} else if ( _.isString( content ) && content.indexOf( '<script' ) !== -1 ) {
|
||||
this.setIframes( null, content, callback, rendered );
|
||||
this.setIframes( '', content, callback, rendered );
|
||||
} else {
|
||||
this.getNodes( function( editor, node, contentNode ) {
|
||||
content = content.body || content;
|
||||
|
@ -465,14 +465,14 @@ window.wp = window.wp || {};
|
|||
importStyles = this.type === 'video' || this.type === 'audio' || this.type === 'playlist';
|
||||
|
||||
this.getNodes( function( editor, node, content ) {
|
||||
// Seems Firefox needs a bit of time to insert/set the view nodes,
|
||||
// or the iframe will fail especially when switching Text => Visual.
|
||||
setTimeout( function() {
|
||||
var dom = editor.dom,
|
||||
styles = '',
|
||||
bodyClasses = editor.getBody().className || '',
|
||||
iframe, iframeDoc, observer, i;
|
||||
|
||||
content.innerHTML = '';
|
||||
head = head || '';
|
||||
|
||||
if ( importStyles ) {
|
||||
if ( ! wp.mce.views.sandboxStyles ) {
|
||||
tinymce.each( dom.$( 'link[rel="stylesheet"]', editor.getDoc().head ), function( link ) {
|
||||
|
@ -489,9 +489,8 @@ window.wp = window.wp || {};
|
|||
}
|
||||
}
|
||||
|
||||
// Seems Firefox needs a bit of time to insert/set the view nodes,
|
||||
// or the iframe will fail especially when switching Text => Visual.
|
||||
setTimeout( function() {
|
||||
content.innerHTML = '';
|
||||
|
||||
iframe = dom.add( content, 'iframe', {
|
||||
/* jshint scripturl: true */
|
||||
src: tinymce.Env.ie ? 'javascript:""' : '',
|
||||
|
@ -588,9 +587,9 @@ window.wp = window.wp || {};
|
|||
editor.off( 'wp-body-class-change', classChange );
|
||||
} );
|
||||
}
|
||||
}, 50 );
|
||||
|
||||
callback && callback.apply( this, arguments );
|
||||
}, 50 );
|
||||
}, rendered );
|
||||
},
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.2-alpha-31739';
|
||||
$wp_version = '4.2-alpha-31740';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue