Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: iframe: add
enqueue_block_assets
#49655Block editor: iframe: add
enqueue_block_assets
#49655Changes from all commits
0282482
bd02ad5
af604c2
184e64f
59fd079
4b2fe2e
e81da56
8efe58d
806d043
7faabe2
4cb3181
6601c53
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Shouldn't this be 6.3.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.
This would be replacing the core function, which was introduced in 6.0.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.
There is an issue using
wp_print_fonts
since it will do nothing if the handles are empty.Before, Gutenberg assigned the registered fonts to the queue so
$wp_fonts
can fallback to the handles in the queue. However, this function doesn't implement that mechanism and it leads to the font styles won't be printedFor example,
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.
@hellofromtonya Is this fixed now since [Fonts API] Relocate which fonts to print from script-loader into wp_print_fonts()? Thanks for looking into it!
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.
@ellatrix Yes, it is fixed via PR #49655. That change was cherry-picked for 15.7.1, which will be released today.
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.
Documenting how we fill this array in core:
styles
wp-polyfill
$script_handles
(script
asset fromblock.json
as well as any other registered by other means)scripts
wp-edit-blocks
wp-block-library-theme
if theme supportswp-block-styles
but hasn't provided anywp-widgets
andwp-edit-widgets
for the widgets editor$style_handles
and$editor_style_handles
(style
andeditorStyles
assets fromblock.json
respectively, as well as any other registered by other means)wp-reset-editor-styles
: avoid enqueuing it in the iframe by adding it to the done queue, so it's ignoredThere 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.
All of this should be covered, except the widgets stuff as the iframe is not being used there right now.
wp-reset-editor-styles
is not added.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've looked at the assets loaded in the iframe for the post editor using the TwentyTwentyThree theme.
Extra things this PR has that are not present in trunk:
enqueue_block_assets
. This is correct. I've used this test plugin:enqueue_block_assets_style_body
is for styles without a.wp-block
classenqueue_block_assets_style_wp_block
is for styles with.wp-block
classThings this PR misses that are present in trunk:
wp-reusable-blocks
. I'm a bit surprised about this. It should have been present because it's a dependency ofwp-edit-blocks
, which is enqueued. The same issue happens withwp-components
and we had to declare it as a dependency ofwp-block-editor-content
for it to be enqueued. It sounds like all dependencies ofwp-edit-blocks
are missing. Any ideas why would this happen? 🤔wp-fonts-local
. It sounds like these are fonts defined by the theme.html.height.auto, body.margin.0
(inline)img.wp-smiley, img.emoji
(inline)dashicons-css
wp-components-css
wp-block-editor-content-css
wp-block-library-css
wp-edit-blocks-css
wp-reusable-blocks-css
wp-fonts-local
(inline)enqueue_block_assets_style_body-css
enqueue_block_assets_style_wp_block-css
enqueue_block_editor_assets_style_wp_block-css
wp-inert-polyfill-js
enqueue_block_assets_script_console-js
enqueue_block_assets_wp_api-js
wp-polyfill-inert-js
regenerator-runtime-js
wp-polyfill-js
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.
wp-reusable-blocks
is not there becausewp-edit-blocks
is added through the compat layer. We need to changewp-edit-blocks
in a follow up PR so it's not added anymore.wp-reusable-blocks
does not contain any styles relevant to the editor content.wp-fonts-local
this is not present in core either. Looks like these are added in the 6.2, but not added to WP core. I don't know why. Since they are not present in core I don't think it's a big deal (see lib/compat/wordpress-6.2/script-loader.php)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 just checked and that's correct! It can be iterated in a follow-up.
This is also enqueued in the front, so it's expected.
What we aimed to get with this PR.