-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Fix: Site editor template previews #33825
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
Conversation
|
Size Change: +60 B (0%) Total Size: 1.08 MB
ℹ️ View Unchanged
|
I know we may have a similar issue in regular block inserter previews in Firefox too. I don't really know the real issue here. |
| // Template previews need the editor styles to be available. | ||
| <EditorStyles | ||
| styles={ settings.styles } | ||
| /> |
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.
Is this needed because the editor styles are only rendered inside the iframe while the previews are outside the iframe? I think @ellatrix has an alternative fix for this (using iframe for previews somewhere)
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.
Yes, #28165 would be the preferred fix.
|
Would #28165 help here at all? |
Template previews are currently broken because of two reasons the height is 0 so they are not visible and the editor styles are not reflected (so they don't reflect the true look of a template).
This PR fixes the editor styles issue and proposes a temporary solution for the height issue.
We have a bug on packages/block-editor/src/components/block-preview/auto.js. Because of some reason contentHeight is always 0. Even though the iframe used for the computation has a height. It seems like useResizeObserver is not returning the height in this case. cc: @youknowriad as someone that worked on packages/block-editor/src/components/block-preview/auto.js in case you are able to help find the root cause of the issue.
How has this been tested?
I went to site editor opened the templates menu navigated with the mouse over the items and verified the template previews appeared.