-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Patterns: Avoid showing block removal warning when deleting a pattern instance that has overrides #59044
Conversation
…ion rules on overridden blocks
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: +19 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in 72b5b6b. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7909094805
|
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.
LGTM, thanks for solving this quickly!
const parentPatternBlocks = | ||
select.getBlockParentsByBlockName( | ||
clientId, | ||
'core/block' | ||
); | ||
// We only need to run this check when editing the original pattern, not pattern instances. | ||
if ( parentPatternBlocks?.length > 0 ) { | ||
continue; | ||
} |
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.
I guess another way is to only have the pattern overrides rule when within a pattern.
No real preference here, but I think it might affect the follow up that's underway.
…lock deletion rules (#59044) * Check we are not within a pattern instance before running block deletion rules on overridden blocks * Make comment more explanatory Co-authored-by: glendaviesnz <glendaviesnz@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org>
I just cherry-picked this PR to the cherry-pick-beta-2 branch to get it included in the next release: 3f62ea1 |
…lock deletion rules (#59044) * Check we are not within a pattern instance before running block deletion rules on overridden blocks * Make comment more explanatory Co-authored-by: glendaviesnz <glendaviesnz@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org>
What?
Checks we are not within a pattern instance before running block deletion rules.
Why?
Currently a user gets a warning then they try to delete a pattern block if it contains blocks with content overrides, but this warning only makes sense if the user is editing the original pattern.
How?
Checks to make sure the block does not have a parent of
core/block
before running the deletion prompt.Testing Instructions
Edit original
and then try deleting one of the overridden blocks and make sure the warning displaysTesting Instructions for Keyboard
Screenshots or screencast
delete-fix.mp4