Repository navigation
Conversation
…rame Script modules enqueued with wp_enqueue_script_module() in enqueue_block_assets ran in the editor's main window but not in the canvas iframe. Collect them like styles and scripts and print the import map and module tags into the iframe's scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🤖 PR meta 🤖🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. 📦 Bundle sizeSize Change: 0 B Total Size: 8.65 MB
⚡ PerformanceShow the resultsClient side metrics exclude the server response time. front-end-block-theme
front-end-classic-theme
media-processing
media-upload
post-editor
site-editor
🏁 Flaky testsSome tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information. reflects the room for notes in the menu in
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
Fixes #64482.
Script modules enqueued with
wp_enqueue_script_module()inenqueue_block_assetsnow run inside the editor canvas iframe (post editor and Site Editor), like styles and classic scripts do.Why?
They ran in the editor's main window and on the front end, but never in the canvas, so blocks that rely on them didn't work in the editor. #69351 reports the same symptom.
How?
A copy of core's
_wp_get_iframed_editor_assets()inlib/compat/wordpress-7.3, swapped in throughblock_editor_settings_all(the same way #49655 did). Besides styles and scripts, it collects script modules: it uses a clone of$wp_script_moduleswith an empty queue (registrations kept) whileenqueue_block_assetsruns, then prints the import map and the enqueued modules into the iframe'sscripts. The return shape and the iframe JS don't change.Core ticket: https://core.trac.wordpress.org/ticket/64360. @sirreal's WordPress/wordpress-develop#10597 and #73765 solve this with a new
wp_print_iframe_htmlaction and anhtmlkey; this PR is a smaller version that keeps the existing API.Testing Instructions
enqueue_block_assets. The module adds a red label in each document it runs in.The new e2e tests in
iframed-equeue-block-assets.spec.js(post editor and Site Editor) fail on trunk and pass with this change.Testing Instructions for Keyboard
No UI change.
Screenshots or screencast
Use of AI Tools
Written with Claude Code (Claude Opus 5.5), reviewed by me.
🤖 Generated with Claude Code
Partly automated with help from Claude.