Opened 4 months ago
Last modified 3 months ago
#64360 new enhancement
enqueue_block_assets action ignores script modules
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Editor | Keywords: | has-patch |
| Focuses: | javascript | Cc: |
Description
The enqueue_block_assets action is used to add scripts and styles in the block editor's iframe.
It should be possible to add script modules to the block editor's iframe as well.
See:
- _wp_get_iframed_editor_assets and its documentation.
- The WP_Script_Modules class.
- The block editor Iframe component in Gutenberg.
This will likely require a new method or exposing more of the script modules internal data so that a specific WP_Script_Modules instance can be used for the iframed assets. See #60597.
Change History (3)
This ticket was mentioned in PR #10597 on WordPress/wordpress-develop by @jonsurrell.
4 months ago
#1
- Keywords has-patch added
#2
@
4 months ago
I've have a functional implementation in https://github.com/WordPress/wordpress-develop/pull/10597 and https://github.com/WordPress/gutenberg/pull/73765.
The changes seem straightforward, the only question may be around how to "clone" the global $wp_script_modules instance.
I'm sharing the work informationally, not to reserve this task for myself if folks are interested in working on it.
#3
@
3 months ago
@ellatrix I'd like to get your thoughts on this. The editor iframe and script modules are incompatible right now. Have you run into or considered this at all?
I've done some work to capture script modules for inclusion in the editor:
I've have a functional implementation in https://github.com/WordPress/wordpress-develop/pull/10597 and https://github.com/WordPress/gutenberg/pull/73765.
@westonruter had some good feedback about a more general way to inject some HTML into the editor.
Trac ticket: https://core.trac.wordpress.org/ticket/64360