From a444cdbc2179dd45385839c8029ca47347016c8a Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Thu, 10 Oct 2024 09:23:52 -0500 Subject: [PATCH] Add comment about why the calculation for scaling needs to happen in the JS --- packages/block-editor/src/components/iframe/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/block-editor/src/components/iframe/index.js b/packages/block-editor/src/components/iframe/index.js index f9ef74b8cd1e49..293742f55683c5 100644 --- a/packages/block-editor/src/components/iframe/index.js +++ b/packages/block-editor/src/components/iframe/index.js @@ -306,6 +306,9 @@ function Iframe( { iframeDocument.documentElement.classList.add( 'is-zoomed-out' ); const maxWidth = 750; + // This scaling calculation has to happen within the JS because CSS calc() can + // only divide and multiply by a unitless value. I.e. calc( 100px / 2 ) is valid + // but calc( 100px / 2px ) is not. iframeDocument.documentElement.style.setProperty( '--wp-block-editor-iframe-zoom-out-scale', scale === 'default'