Cover: declare the inner blocks template in block type settings#80120
Cover: declare the inner blocks template in block type settings#80120ellatrix wants to merge 1 commit into
Conversation
Declare the cover template in block type settings so it is scaffolded at insertion like other blocks. The placeholder now shows whenever there is no background and the inner blocks are at most the untouched scaffold paragraph, and it returns when the background is removed from a contentless cover. The placeholder-exit handlers select the scaffolded paragraph so typing the title works right away. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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. |
|
Size Change: +84 B (0%) Total Size: 7.67 MB 📦 View Changed
|
What?
Declares the Cover block's inner blocks template in its block type settings, like every other block in #80027, and teaches the placeholder to show whenever the block has no background and no content.
Alternative to #80028, following #80028 (comment). Built on top of #80027.
Why?
On trunk the placeholder worked by accident: the placeholder branch returns early without rendering the inner blocks container, so the template only applied once a background was chosen. With templates applied at insertion (#80027), the scaffolded paragraph would suppress the placeholder forever. Instead of scaffolding imperatively in every placeholder-exit handler (#80028), the placeholder condition absorbs the logic: a single empty scaffold paragraph does not count as content.
How?
fontSize: 'large'attribute is now unconditional; the theme font size check cannot be expressed statically.hasInnerBlocksbecomeshasInnerContentin the placeholder condition: more than one inner block, or one block that is not an empty paragraph.templateInsertUpdatesSelection. Forgetting a future handler only costs focus, never content.Behavior changes:
The image transform e2e test raced the upload: transforming before completion silently loses the image on trunk too, but the paragraph masked the placeholder so the test passed. It now waits for the final URL.
Testing Instructions
Testing Instructions for Keyboard
Insert a Cover, Tab to a color swatch in the placeholder, press Enter, and type the title.
Use of AI Tools
🤖 Generated with Claude Code