-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 Editor: Ensure synced patterns are accounted for in 'getAllowedBlocks' #52546
Conversation
Size Change: +11 B (0%) Total Size: 1.43 MB
ℹ️ View Unchanged
|
Flaky tests detected in e0831a6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5527988086
|
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 George!
…dd/defer-script-loading-strategy * 'trunk' of https://github.com/WordPress/gutenberg: Update Changelog for 16.2.0 Adding support for defined IDs in `TextControl` component (#52028) Bump plugin version to 16.2.0 Revert "Bump plugin version to 16.2.0" Bump plugin version to 16.2.0 Add maxLength to LinkControl search items (#52523) [RNMobile] Update Editor block inserter button styles and default text input placeholder/selection styles (#52269) Site Editor: Reset device preview type when exiting the editing mode (#52566) Trim footnote anchors from excerpts (#52518) Add back old Navigation and File blocks JavaScript implementation when Gutenberg is not installed (#52553) Block Editor: Ensure synced patterns are accounted for in 'getAllowedBlocks' (#52546) Fix md5 class messed up with new block key (#52557) Fix entity cache misses for single posts due to string as recordKey (#52338) Make "My patterns" permanently visible (#52531) Hide site hub when resizing frame upwards to avoid overlap (#52180) Fix "Manage all patterns" link appearance (#52532) Update navigation menu title size & weight in detail panels (#52477) Site Editor Patterns: Ensure sidebar does not shrink when long pattern titles are used (#52547) Site Editor: Restore quick inserter 'Browse all' button (#52529) Patterns: update the title of Pattern block in the block inspector card (#52010)
What?
Fixes #52401.
PR updates the
getAllowedBlocks
selector and ensures the Synced Patterns (reusable blocks) are accounted for when checking allowed block types.This fixes a bug with the inserter when a block has only two allowed blocks specified, and one of them is synced pattern.
Why?
getAllowedBlocks
hasn't accounted for this and incorrectly enabled "smart appender".How?
I added a separate check if the reusable block can be inserted and append the block name to the allowed block list. This matches the logic in
hasInserterItems
andgetInserterItems
.Testing Instructions
allowedBlocks
defined.Example block
Screenshots or screencast
CleanShot.2023-07-12.at.09.27.59.mp4