Repository navigation
[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.
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
|
|
Flaky tests detected in 707d63893481a5fe88b6fcfa6a0e068a21600d3c. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6008675742
|
|
FYI #53974. |
0b42ff2 to
32c4caf
Compare
draganescu
left a comment
There was a problem hiding this comment.
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/ungroupcommands 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
ungroupcommand shouldn't be available. Same goes if we have multiple selected blocks.Extra testing
Since I've changed
useConvertToGroupButtonPropsto use the new selectors, some test is needed to verify there is no regression in showing thegroup/ungroupbuttons in block settings dropdown menu on different scenarios.