Skip to content

Commit

Permalink
Add shouldZoom prop to only use zooming if desired
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Feb 24, 2024
1 parent 02e2f90 commit 0f21675
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
24 changes: 13 additions & 11 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function Iframe( {
contentRef,
children,
tabIndex = 0,
shouldZoom = false,
readonly,
forwardedRef: ref,
...props
Expand Down Expand Up @@ -135,17 +136,18 @@ function Iframe( {
// content within the viewport.
// At 1000px wide, the iframe is scaled to 45%.
// At 400px wide, the iframe is scaled to 90%.
const scale = ! isZoomOutMode
? 1
: calculateScale(
{
maxWidth: 1000,
minWidth: 400,
maxScale: 0.45,
minScale: 0.9,
},
contentWidth
);
const scale =
isZoomOutMode && shouldZoom
? calculateScale(
{
maxWidth: 1000,
minWidth: 400,
maxScale: 0.45,
minScale: 0.9,
},
contentWidth
)
: 1;
const frameSize = isZoomOutMode ? 100 : 0;

const setRef = useRefEffect( ( node ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function EditorCanvas( { enableResizing, settings, children, ...props } ) {
renderAppender={ showBlockAppender }
styles={ styles }
iframeProps={ {
shouldZoom: true,
className: classnames(
'edit-site-visual-editor__editor-canvas',
{
Expand Down

0 comments on commit 0f21675

Please sign in to comment.