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 <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-08-09 11:16:17 +02:00 committed by GitHub
parent 1561024d6e
commit 7e691560d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View File

@ -246,6 +246,7 @@ function ScaledBlockPreview( {
// @ts-ignore disabled prop exists
scrolling={ isScrollable ? 'yes' : 'no' }
tabIndex={ -1 }
canEnableZoomOutView={ true }
readonly={
! isFullComposabilityFeatureAndAPIAvailable()
}

View File

@ -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 = (

View File

@ -0,0 +1,4 @@
Significance: minor
Type: fix
CYS: disable zoom out on fonts/color pairs iframe