-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block editor canvas iframe: play around with restricting max height of iframe #58484
Conversation
- pass block editor canvas container element properties (height) down to iframe. For this experiment just pass container height. - Use container height as the max height of the iframe. - Set maxheight of iframe when in iframe zoom mode to avoid iframe stretching where blocks have vh set - Turn off unhelpful transition animations - Use container height as the max height of the iframe. - Set maxheight of iframe when in iframe zoom mode to avoid iframe stretching where blocks have vh set - Turn off unhelpful transition animations
className: classnames( | ||
'edit-site-visual-editor__editor-canvas', | ||
{ | ||
'is-focused': isFocused && canvasMode === 'view', | ||
} | ||
), | ||
maxHeight: | ||
isZoomOutMode && containerHeight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we wouldn't want to set a maxHeight in isZoomOutMode
always.
Right now I'm just testing in the site editor when browsing styles.
Size Change: +122 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
revert unintended change to frameSize
@@ -59,12 +63,25 @@ export default function SiteEditorCanvas() { | |||
const isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE; | |||
const isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode; | |||
const forceFullHeight = isNavigationFocusMode; | |||
const [ containerHeight, setContainerHeight ] = useState(); | |||
const containerRef = useRefEffect( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect this is not ideal.
It's a lot of faffery just to passing down the iframe container's height.
Maybe we pass down the ref? 🤷🏻
// const maxHeight = props.style?.maxHeight || 0; | ||
const maxContentHeight = | ||
maxHeight && contentHeight > maxHeight | ||
? maxHeight / ( 1 - scale ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scale the maxHeight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we could get the container height using DOM API here instead 🤷🏻
Would save all the ref passing and other chicanery
In #59334, html now scales instead of the iframe, so the problem this PR is trying to solve may no longer occur. |
Thanks @t-hamano I'd forgotten about this PR 😄 You're right: it looks much better. 2024-02-28.15.49.40.mp4 |
An experiment only:
Some example HTML
Before
2024-01-31.16.09.59.mp4
After
2024-01-31.16.08.41.mp4
What?
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast