Skip to content
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

Plugin: Only apply the viewScript compat to core blocks #48268

Closed
wants to merge 3 commits into from

Conversation

dd32
Copy link
Member

@dd32 dd32 commented Feb 21, 2023

See #45870

What?

This PR limits the functionality in gutenberg_block_type_metadata_multiple_view_scripts() to gutenberg-provided blocks only.

Why?

This is done as gutenberg_block_type_metadata_multiple_view_scripts() relies upon gutenberg_block_type_metadata_view_script() which only operates on files present within Gutenberg.

As noted within #45870 this causes WordPress 6.1 + Gutenberg plugin to be unable to use a block which has multiple items in the viewScript property.

How?

The exclusion logic from gutenberg_block_type_metadata_view_script() is copied to gutenberg_block_type_metadata_multiple_view_scripts().

This ensures that any viewScripts that are from plugin-provided blocks fall through to the Core support.

Testing Instructions

  1. Add a block with viewScript: [ "file:./index.js", "registered-script-handle", "script-handle-two" ]
  2. View the front-end page source with that block present. All three handles should be present.

Testing Instructions for Keyboard

Screenshots or screencast

@gziolo gziolo added the [Feature] Block API API that allows to express the block paradigm. label Feb 21, 2023
@gziolo gziolo added the Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts label Mar 6, 2023
@gziolo
Copy link
Member

gziolo commented Mar 19, 2023

I left a comment in the issue #45870 (comment). The gist of it is we should move this updated hook to provide back compat only as long as we support WP 6.0.

@gziolo
Copy link
Member

gziolo commented Apr 26, 2023

I left a comment in the issue #45870 (comment). The gist of it is we should move this updated hook to provide back compat only as long as we support WP 6.0.

It looks like we will drop support for WordPress 6.0 with #48268. I think we can close this PR now, as the alternative completely removes the custom handling in the Gutenberg plugin.

@gziolo gziolo closed this Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants