BlockCanvas: Fix the height prop and width of the block editor#65977
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.
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
|
| style={ { | ||
| ...props.style, | ||
| height: props.style?.height, | ||
| border: 0, |
There was a problem hiding this comment.
Where was this border coming from that it has to be reset here?
There was a problem hiding this comment.
The browser default for iframes.
There was a problem hiding this comment.
Oh, maybe a tiny comment would help.
draganescu
left a comment
There was a problem hiding this comment.
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". |
draganescu
left a comment
There was a problem hiding this comment.
For me nothing is broken here. ![]()
ajlende
left a comment
There was a problem hiding this comment.
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?
Iframecomponent.Testing Instructions
1- Run storybook locally
npm run storybook:dev2- 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.