From 2f7f4cc0d7ba1f522d2f66cdc681395c332f636f Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Mon, 10 Jul 2017 18:14:56 -0700 Subject: [PATCH] Use window.parent instead of window.top for sending resize messages --- components/sandbox/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/sandbox/index.js b/components/sandbox/index.js index fac62404fe174b..436ac597619eaf 100644 --- a/components/sandbox/index.js +++ b/components/sandbox/index.js @@ -73,7 +73,7 @@ export default class Sandbox extends wp.element.Component { ( function() { var observer; - if ( ! window.MutationObserver || ! document.body || ! window.top ) { + if ( ! window.MutationObserver || ! document.body || ! window.parent ) { return; } @@ -81,7 +81,7 @@ export default class Sandbox extends wp.element.Component { var clientBoundingRect, computedStyle; clientBoundingRect = document.body.getBoundingClientRect(); computedStyle = getComputedStyle( document.body ); - window.top.postMessage( { + window.parent.postMessage( { action: 'resize', width: clientBoundingRect.width + parseFloat( computedStyle.marginLeft ) + parseFloat( computedStyle.marginRight ), height: clientBoundingRect.height + parseFloat( computedStyle.marginTop ) + parseFloat( computedStyle.marginBottom )