-
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
BlockCanvas: Fix the height prop and width of the block editor #65977
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
$prev-container-width: var(--wp-block-editor-iframe-zoom-out-prev-container-width, 100vw); | ||
width: $prev-container-width; | ||
margin-left: calc(-1 * (#{$prev-container-width} - #{$container-width}) / 2); | ||
} |
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 moved these tiles to style.scss instead of content.scss because AFAIK these apply to elements that are rendered outside of the iframe.
Size Change: +48 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
@@ -380,6 +380,7 @@ function Iframe( { | |||
style={ { | |||
...props.style, | |||
height: props.style?.height, | |||
border: 0, |
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.
Where was this border coming from that it has to be reset here?
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.
The browser default for iframes.
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.
Oh, maybe a tiny comment would help.
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.
Smoke testing the zoom out feature didn't produce any issues for me. I dont understand the border situation, also why did moving the styles fix the issue, or was moving the styles unrelated to height?
the Third-party block editor implementations don't load "content" styles outside the iframe (content). So moving the styles out of the content styles into their right place fixes the issue for the "height". |
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.
For me nothing is broken here.
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.
TIL. Thanks for the fix!
Should this be backported to 6.7? |
It's not necessary for 6.7, it's mostly for npm package users. |
I need this backported for #66034. I'll get that setup. |
There was a conflict while trying to cherry-pick the commit to the wp/6.7 branch. Please resolve the conflict manually and create a PR to the wp/6.7 branch. PRs to wp/6.7 are similar to PRs to trunk, but you should base your PR on the wp/6.7 branch instead of trunk.
|
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
Backport here: #66129 |
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
@ajlende @jeryj @youknowriad As I understand it this ended up being backported as part of #66182. I'm going to update the labels accordingly. |
…ress#65977) Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: oandregal <oandregal@git.wordpress.org> Co-authored-by: ajlende <ajlende@git.wordpress.org>
closes #65976
What?
When building third-party block editors, you can set the height of the block canvas using the height prop in theory. (See https://wordpress.org/gutenberg-framework/docs/intro)
This regressed recently it seems. There are also other related issues:
This PR addresses all of these issues.
How?
Iframe
component.Testing Instructions
1- Run storybook locally
npm run storybook:dev
2- Open the playground box story
3- Notice that the height of the canvas is set to 500px, there's no extra border for the iframe and that the width of the canvas is 100%
I think some of the regressions were related to zoom-out, so make sure to test zoom-out as well.