Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix empty space below
  • Loading branch information
ntsekouras committed Sep 7, 2022
commit c0d9e249ee740591cd42da2d3295966e417e916f
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,6 @@
&.is-zoomed-out {
transform-origin: top center;
transform: scale(0.45);
margin-bottom: -70%;

> .block-list-appender {
display: none;
Expand Down
20 changes: 19 additions & 1 deletion packages/block-editor/src/components/iframe/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import {
useReducer,
} from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { useMergeRefs, useRefEffect } from '@wordpress/compose';
import {
useResizeObserver,
useMergeRefs,
useRefEffect,
} from '@wordpress/compose';
import { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';

/**
Expand Down Expand Up @@ -194,6 +198,8 @@ function Iframe(
const scripts = useParsedAssets( assets?.scripts );
const clearerRef = useBlockSelectionClearer();
const [ before, writingFlowRef, after ] = useWritingFlow();
const [ contentResizeListener, { height: contentHeight } ] =
useResizeObserver();
const setRef = useRefEffect( ( node ) => {
function setDocumentIfReady() {
const { contentDocument, ownerDocument } = node;
Expand Down Expand Up @@ -305,7 +311,19 @@ function Iframe(
'is-zoomed-out': isZoomedOut,
}
) }
style={
isZoomedOut
? {
// This is the remaining percentage from the scaling down
// of the iframe body(`scale(0.45)`).
marginBottom: `-${
contentHeight * 0.55
}px`,
}
: {}
}
>
{ contentResizeListener }
{ /*
* This is a wrapper for the extra styles and scripts
* rendered imperatively by cloning the parent,
Expand Down