#8222 closed defect (bug) (reported-upstream)
Properly enqueue block style_handles in pattern editor
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Component: | Pattern Directory | Keywords: | has-patch |
| Cc: |
Description
The function _wp_get_iframed_editor_assets enqueues editor_style_handles, but not style_handles.
In the admin editor, frontend styles are already on the page, so this works. In a frontend block editor (e.g. Pattern Creator), they are never loaded, breaking blocks like Cover that rely on them for canvas layout/background CSS.
Additionally, __unstableIframe dropped its head prop in Gutenberg 22.x, preventing EditorStyles from injecting theme styles into the canvas (fonts, CSS custom properties, etc.).
The proposed patch here carries workarounds for both:
- PHP: hooks into enqueue_block_assets to enqueue style_handles inside the capture window
- JS: moves EditorStyles from the head prop to a child of Iframe
Attachments (3)
Change History (7)
@
6 weeks ago
Backend with patch applied (styles are properly attached, visually looks like frontend)
This ticket was mentioned in Slack in #meta by jonsurrell. View the logs.
6 weeks ago
#3
@
6 weeks ago
- Component changed from General to Pattern Directory
- Resolution set to reported-upstream
- Status changed from new to closed
@bor0 Please check you select the correct component, as in this case it'd redirect you to the Github source where you can PR it :) https://github.com/WordPress/pattern-directory/pulls
#4
@
6 weeks ago
Thanks! Created https://github.com/WordPress/pattern-directory/pull/740
Frontend with patch applied (no visual changes)