Skip to content

Commit

Permalink
Move CSS back to original location, as it no longer needs to be moved
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj authored and ajlende committed Nov 25, 2024
1 parent fc6b4ee commit 2325135
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/block-editor/src/components/iframe/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@
}

.block-editor-iframe__html {
$frame-size: var(--wp-block-editor-iframe-zoom-out-frame-size, 0);
$scale: var(--wp-block-editor-iframe-zoom-out-scale, 1);
scale: $scale;
transform-origin: top center;
// Add the top/bottom frame size. We use scaling to account for the left/right, as
// the padding left/right causes the contents to reflow, which breaks the 1:1 scaling
// of the content.
padding-top: calc(#{$frame-size} / #{$scale});
padding-bottom: calc(#{$frame-size} / #{$scale});
// Prevents a flash of background color change when entering/exiting zoom out
transition: background-color 400ms;

Expand All @@ -30,12 +22,15 @@
}

&.is-zoomed-out {
$scale: var(--wp-block-editor-iframe-zoom-out-scale, 1);
$frame-size: var(--wp-block-editor-iframe-zoom-out-frame-size, 0);
$inner-height: var(--wp-block-editor-iframe-zoom-out-inner-height);
$content-height: var(--wp-block-editor-iframe-zoom-out-content-height);
$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((#{$scale-container-width} - #{$container-width}) / 2 / #{$scale}));
scale: $scale;
background-color: $gray-300;

// Chrome seems to respect that transform scale shouldn't affect the layout size of the element,
Expand All @@ -45,6 +40,12 @@
$total-height: calc(#{$extra-content-height} + #{$total-frame-height} + 2px);
margin-bottom: calc(-1 * #{$total-height});

// Add the top/bottom frame size. We use scaling to account for the left/right, as
// the padding left/right causes the contents to reflow, which breaks the 1:1 scaling
// of the content.
padding-top: calc(#{$frame-size} / #{$scale});
padding-bottom: calc(#{$frame-size} / #{$scale});

body {
min-height: calc((#{$inner-height} - #{$total-frame-height}) / #{$scale});

Expand Down

0 comments on commit 2325135

Please sign in to comment.