TinyMCE wpView: resize sandbox iframes on load. Fixes a problem with resizing after all images are loaded.

Props iseulde, mattheu. Fixes #31480.
Built from https://develop.svn.wordpress.org/trunk@32056


git-svn-id: http://core.svn.wordpress.org/trunk@32035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2015-04-06 18:55:28 +00:00
parent 42028327a2
commit 541573b378
3 changed files with 7 additions and 4 deletions

View File

@ -489,8 +489,7 @@ window.wp = window.wp || {};
var dom = editor.dom,
styles = '',
bodyClasses = editor.getBody().className || '',
editorHead = editor.getDoc().getElementsByTagName( 'head' )[0],
iframe, iframeDoc, observer, i;
editorHead = editor.getDoc().getElementsByTagName( 'head' )[0];
tinymce.each( dom.$( 'link[rel="stylesheet"]', editorHead ), function( link ) {
if ( link.href && link.href.indexOf( 'skins/lightgray/content.min.css' ) === -1 &&
@ -503,6 +502,8 @@ window.wp = window.wp || {};
// Seems the browsers need a bit of time to insert/set the view nodes,
// or the iframe will fail especially when switching Text => Visual.
setTimeout( function() {
var iframe, iframeDoc, observer, i;
content.innerHTML = '';
iframe = dom.add( content, 'iframe', {
@ -572,6 +573,8 @@ window.wp = window.wp || {};
}
}
$( iframe.contentWindow ).on( 'load', resize );
if ( MutationObserver ) {
observer = new MutationObserver( _.debounce( resize, 100 ) );

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.2-beta4-32055';
$wp_version = '4.2-beta4-32056';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.