-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Site Editor: list view needs enqueue_block_editor_assets
#37043
Conversation
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.
Thanks, makes sense. Could you please add the doc comment for the action before the call to do_action()
?
This doesn't make a lot of sense to me though. The list view isn't a block editor, it's just a screen/page. Enqueuing block-editor assets seems like an overkill. We could add another filter/action if needed though.
Just because the loading code is hooked in |
The problem is that In the medium term, we probably ought to consider deprecating this hook or evolving it. For example we could add an argument to add_action( 'enqueue_block_editor_assets', function( $context ) {
if ( 'site-list' === $context→id ) {
...
}
} ); In the short term, I guess we have to decide whether the list list view should fire this action or fire a different action. @kevin940726 makes a good point that there's no "editor" in the list view. I am not sure. What do you think, @youknowriad? |
I think I agree with @kevin940726 The list view doesn't seem like an editor to me. Can't third party plugins just use the regular WP Admin hooks to enqueue their scripts and styles there? |
I think that passing a This PR would be transparently resolved by simply avoiding making the template list views separate screens within the Site Editor, as has been discussed elsewhere. Previous iterations of the Site Editor transparently flowed between template/part/page modes in a SPA-like manner and I don't understand why this iteration is departing from that. Otherwise, since |
Given the unenthusiasm for this approach and the solution in #36488 that makes this irrelevant, I will close this. |
Description
The list view introduced in #36379 does not fire the
enqueue_block_editor_assets
action. It is possible that this oversight was intentional so as to keep that pageload faster, but it breaks any editor customization that depends on it. All of our other specialized editor instances (widgets, nav menus) have used it, and this should too.For instance, on WordPress.com, we use
apiFetch.setFetchHandler
to rewrite REST API requests to our centralizedpublic-api.wordpress.com
URL. All of the loading code for this is hooked toenqueue_block_editor_assets
, the correct place to add assets to the editor.How has this been tested?
Load the list view page, expected code hooked to
enqueue_block_editor_assets
is loaded.Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: