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

Block Hooks: Issue warning about child insertion into semi-incompatible blocks #5810

Draft
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Dec 21, 2023

Early-stage WIP. If a plugin tries to insert a hooked block in a position that (currently) won't work in the editor, we might want to alert them (e.g. via _doing_it_wrong).

Trac ticket: TBD


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@ockham ockham self-assigned this Dec 21, 2023
@ockham ockham changed the title Add/warning about child insertion into incompatible blocks Block Hooks: Issue warning about child insertion into semi-incompatible blocks Dec 21, 2023
@ockham ockham force-pushed the add/warning-about-child-insertion-into-incompatible-blocks branch from 18ad164 to ee00e65 Compare December 21, 2023 13:53
@ockham
Copy link
Contributor Author

ockham commented Dec 21, 2023

cc/ @gziolo

Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@gziolo
Copy link
Member

gziolo commented Jan 2, 2024

If a plugin tries to insert a hooked block in a position that (currently) won't work in the editor, we might want to alert them (e.g. via _doing_it_wrong).

One thing we discussed, was adding a block supports flag that lets the block author to opt-out from allowing hooking the block on a certain position rather than hardcoding only the list for the core blocks that we know aren't compatible. However, it might be enough to go with the simple solution for now as it clearly applies to very complex blocks that source their content from external sources.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants