From 0dd81fe13489bbb1455ba748573523dd73798608 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sun, 15 Feb 2015 18:18:06 +0000 Subject: [PATCH] TinyMCE wpView: fire `nodeChanged` when an embedded iframe is resized so we can adjust the editor height and other UI components. Props iseulde, fixes #30646. git-svn-id: https://develop.svn.wordpress.org/trunk@31466 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/mce-view.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js index 209a7b9e20..5f4d846999 100644 --- a/src/wp-includes/js/mce-view.js +++ b/src/wp-includes/js/mce-view.js @@ -207,8 +207,18 @@ window.wp = window.wp || {}; iframeDoc.close(); resize = function() { + var $iframe, iframeDocHeight; + // Make sure the iframe still exists. - iframe.contentWindow && $( iframe ).height( $( iframeDoc.body ).height() ); + if ( iframe.contentWindow ) { + $iframe = $( iframe ); + iframeDocHeight = $( iframeDoc.body ).height(); + + if ( $iframe.height() !== iframeDocHeight ) { + $iframe.height( iframeDocHeight ); + editor.nodeChanged(); + } + } }; if ( MutationObserver ) {