From 7e691560d46a3ef7e165217c97db233c4b323131 Mon Sep 17 00:00:00 2001 From: Luigi Teschio Date: Fri, 9 Aug 2024 11:16:17 +0200 Subject: [PATCH] CYS: disable zoom out on fonts/color pairs iframe (#50498) * CYS: disable zoom out on fonts iframe * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions --- .../customize-store/assembler-hub/auto-block-preview.tsx | 1 + .../client/customize-store/assembler-hub/iframe.jsx | 6 ++++-- plugins/woocommerce/changelog/50498-fix-fonts-zoom-out | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 plugins/woocommerce/changelog/50498-fix-fonts-zoom-out diff --git a/plugins/woocommerce-admin/client/customize-store/assembler-hub/auto-block-preview.tsx b/plugins/woocommerce-admin/client/customize-store/assembler-hub/auto-block-preview.tsx index 03f7c2d42d1..a962d373431 100644 --- a/plugins/woocommerce-admin/client/customize-store/assembler-hub/auto-block-preview.tsx +++ b/plugins/woocommerce-admin/client/customize-store/assembler-hub/auto-block-preview.tsx @@ -246,6 +246,7 @@ function ScaledBlockPreview( { // @ts-ignore disabled prop exists scrolling={ isScrollable ? 'yes' : 'no' } tabIndex={ -1 } + canEnableZoomOutView={ true } readonly={ ! isFullComposabilityFeatureAndAPIAvailable() } diff --git a/plugins/woocommerce-admin/client/customize-store/assembler-hub/iframe.jsx b/plugins/woocommerce-admin/client/customize-store/assembler-hub/iframe.jsx index 2a7e2927fdd..bbb7480f22a 100644 --- a/plugins/woocommerce-admin/client/customize-store/assembler-hub/iframe.jsx +++ b/plugins/woocommerce-admin/client/customize-store/assembler-hub/iframe.jsx @@ -41,6 +41,7 @@ function Iframe( { readonly, forwardedRef: ref, title = __( 'Editor canvas', 'woocommerce' ), + canEnableZoomOutView = false, ...props } ) { const { resolvedAssets } = useSelect( ( select ) => { @@ -123,7 +124,7 @@ function Iframe( { }; }, [] ); - const isZoomedOut = scale !== 1; + const isZoomedOut = scale !== 1 && canEnableZoomOutView; useEffect( () => { if ( ! isZoomedOut && ! prevContainerWidth.current ) { @@ -180,7 +181,7 @@ function Iframe( { useEffect( () => cleanup, [ cleanup ] ); useEffect( () => { - if ( ! iframeDocument || ! isZoomedOut ) { + if ( ! canEnableZoomOutView || ! iframeDocument || ! isZoomedOut ) { return; } @@ -247,6 +248,7 @@ function Iframe( { containerWidth, windowInnerWidth, isZoomedOut, + canEnableZoomOutView, ] ); const iframe = ( diff --git a/plugins/woocommerce/changelog/50498-fix-fonts-zoom-out b/plugins/woocommerce/changelog/50498-fix-fonts-zoom-out new file mode 100644 index 00000000000..1a00e0a30ec --- /dev/null +++ b/plugins/woocommerce/changelog/50498-fix-fonts-zoom-out @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +CYS: disable zoom out on fonts/color pairs iframe \ No newline at end of file