-
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
[Commands]: Add group/ungroup commands only when eligible #53988
Conversation
* @param {string} clientId Client Id of the block. If not passed the selected block's client id will be used. | ||
* @return {boolean} True if the block is ungroupable. | ||
*/ | ||
export const isUngroupable = createRegistrySelector( |
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.
Personally I think it makes sense to have this logic in selectors. We could always make the private if it's not desired to expose them yet.
Size Change: +148 B (0%) Total Size: 1.51 MB
ℹ️ View Unchanged
|
...es/block-editor/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js
Outdated
Show resolved
Hide resolved
Flaky tests detected in 707d63893481a5fe88b6fcfa6a0e068a21600d3c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6008675742
|
FYI #53974. |
0b42ff2
to
32c4caf
Compare
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.
Din't test but the code changes look good.
The only problem I see is with making groupable / ungroupable selectors public. If people lean into them and we change the criteria of groupable and ungroupable we'll need to maintain back compat on this.
Groupable and ungroupable seems today as something internal to the block editor not something to depend on.
32c4caf
to
f30e257
Compare
What?
Fixes: #53921
The
group/ungroup
commands are shown even if they conditions for grouping or ungrouping is met. This PR fixes that, by making the proper checks, for example if the selected blocks can be removed, etc..Testing Instructions
Some examples:
3. If a block is locked, it cannot be grouped or ungrouped
4. If we have not selected a single grouping block(ex a Paragraph block), the
ungroup
command shouldn't be available. Same goes if we have multiple selected blocks.Extra testing
Since I've changed
useConvertToGroupButtonProps
to use the new selectors, some test is needed to verify there is no regression in showing thegroup/ungroup
buttons in block settings dropdown menu on different scenarios.