Skip to content

Commit

Permalink
Rename outerContainerWidth to scaleContainerWiddth
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Oct 16, 2024
1 parent 7091205 commit 69836c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/iframe/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
$frame-size: var(--wp-block-editor-iframe-zoom-out-frame-size);
$inner-height: var(--wp-block-editor-iframe-zoom-out-inner-height);
$content-height: var(--wp-block-editor-iframe-zoom-out-content-height);
$outer-container-width: var(--wp-block-editor-iframe-zoom-out-outer-container-width);
$scale-container-width: var(--wp-block-editor-iframe-zoom-out-scale-container-width);
$container-width: var(--wp-block-editor-iframe-zoom-out-container-width, 100vw);
// Apply an X translation to center the scaled content within the available space.
transform: translateX(calc((#{$outer-container-width} - #{$container-width}) / 2 / #{$scale}));
transform: translateX(calc((#{$scale-container-width} - #{$container-width}) / 2 / #{$scale}));
scale: #{$scale};
background-color: $gray-300;

Expand Down
16 changes: 8 additions & 8 deletions packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function Iframe( {
}
}, [ containerWidth, isZoomedOut ] );

const outerContainerWidth = Math.max(
const scaleContainerWidth = Math.max(
initialContainerWidth.current,
containerWidth
);
Expand Down Expand Up @@ -357,7 +357,7 @@ function Iframe( {
scale === 'default'
? ( Math.min( containerWidth, maxWidth ) -
parseInt( frameSize ) * 2 ) /
outerContainerWidth
scaleContainerWidth
: scale
);

Expand All @@ -379,8 +379,8 @@ function Iframe( {
`${ containerWidth }px`
);
iframeDocument.documentElement.style.setProperty(
'--wp-block-editor-iframe-zoom-out-outer-container-width',
`${ outerContainerWidth }px`
'--wp-block-editor-iframe-zoom-out-scale-container-width',
`${ scaleContainerWidth }px`
);

return () => {
Expand All @@ -400,7 +400,7 @@ function Iframe( {
'--wp-block-editor-iframe-zoom-out-container-width'
);
iframeDocument.documentElement.style.removeProperty(
'--wp-block-editor-iframe-zoom-out-outer-container-width'
'--wp-block-editor-iframe-zoom-out-scale-container-width'
);
};
}, [
Expand All @@ -412,7 +412,7 @@ function Iframe( {
containerWidth,
windowInnerWidth,
isZoomedOut,
outerContainerWidth,
scaleContainerWidth,
] );

// Make sure to not render the before and after focusable div elements in view
Expand Down Expand Up @@ -502,8 +502,8 @@ function Iframe( {
isZoomedOut && 'is-zoomed-out'
) }
style={ {
'--wp-block-editor-iframe-zoom-out-outer-container-width':
isZoomedOut && `${ outerContainerWidth }px`,
'--wp-block-editor-iframe-zoom-out-scale-container-width':
isZoomedOut && `${ scaleContainerWidth }px`,
} }
>
{ iframe }
Expand Down
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/iframe/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
}

.block-editor-iframe__scale-container.is-zoomed-out {
$outer-container-width: var(--wp-block-editor-iframe-zoom-out-outer-container-width, 100vw);
width: $outer-container-width;
$scale-container-width: var(--wp-block-editor-iframe-zoom-out-scale-container-width, 100vw);
width: $scale-container-width;
// Position the iframe so that it is always aligned with the right side so that
// the scrollbar is always visible on the right side
position: absolute;
Expand Down

0 comments on commit 69836c3

Please sign in to comment.