-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Block Hooks: Enable first/last child insertion next to Classic block #69241
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: Enable first/last child insertion next to Classic block #69241
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
96ba114 to
706f354
Compare
|
In a00e72d I replicated the existing tests for the post written with blocks for the case when the content was crafted with Classic Editor. The code changes look good and I was able to confirm in my testing it works as expected. |
|
Size Change: 0 B Total Size: 1.84 MB ℹ️ View Unchanged
|
…69241)x Allow insertion of a hooked block as the first or last child of the Post Content block (and, less importantly, of the Synced Pattern and Navigation blocks). Co-authored-by: ockham <[email protected]> Co-authored-by: gziolo <[email protected]> Co-authored-by: t-hamano <[email protected]>
|
I've cherry-picked 8c0db8e to the |
…ordPress#69241)x Allow insertion of a hooked block as the first or last child of the Post Content block (and, less importantly, of the Synced Pattern and Navigation blocks). Co-authored-by: ockham <[email protected]> Co-authored-by: gziolo <[email protected]> Co-authored-by: t-hamano <[email protected]>
…ordPress#69241)x Allow insertion of a hooked block as the first or last child of the Post Content block (and, less importantly, of the Synced Pattern and Navigation blocks). Co-authored-by: ockham <[email protected]> Co-authored-by: gziolo <[email protected]> Co-authored-by: t-hamano <[email protected]>
What?
Closes #68988.
Allow insertion of a hooked block as the first or last child of the Post Content block (and, less importantly, of the Synced Pattern and Navigation blocks).
Why?
As of #67272, Block Hooks are applied to post content. This includes injecting hooked blocks as the first or last child of the Post Content block. However, this didn't work if the post content itself didn't contain any block markup (which is possible if it was originally created in the classic editor, or if it only contains one Classic block).
This limitation is due to the way hooked block insertion works (explained here).
How?
By wrapping content that doesn't contain any blocks in a temporary Classic block wrapper, and removing the latter after Block Hooks have been applied.
Testing Instructions
Screenshots or screencast