-
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
Enables Block Grouping/UnGrouping using core/group #14908
Conversation
packages/editor/src/components/convert-to-group-buttons/convert-button.js
Outdated
Show resolved
Hide resolved
@kjellr Might I trouble you for suitable icons for
|
I really dig this. Impressive work for what you call "rudimentary". My very first instinct was: this should be in the switcher. The action is the same as when you create a quote — select multiple blocks, use switcher, choose quote. Group should be there. At the same time, I would love to see a ⌘G shortcut for grouping blocks together, and this would be more discoverable if it sits in the More menu with a shortcut tip on the right. To echo Matías, I could support having this work in both places, just for that reason. But I would also suggest that if we can only have one, or if we need to start small, I would put this in the block switcher first. |
Some light research suggests a fairly standard representation of "grouped" and "ungrouped" elements is the common representation of this idea. Here's Keynote and Sketch: Oddly enough, Material doesn't have icons like these. ¯_(ツ)_/¯ The "layers" icons seem to be the closest: We could also do something custom, along the lines of: If you want to plug something in while we think about it, here are the svgs for the bottom option: |
c17e571
to
2b6f334
Compare
As provided here #14908 (comment)
UpdateI have updated this PR to include support for grouping via
Important note: as it stands the The keyboard shortcut follows the convention from Google Docs @kjellr I've added the Group icon as provided. We're also missing "UnGroup" but this isn't currently possible as the 📺 ScreencastYou can watch a screencast here. Feedback RequiredI'm looking for guidance on how we could implement wildcard block transforms via
|
Another update 🙈This commit has modified the logic around Block transformations logic to enable wildcard Block transforms. The following is a high level summary:
The last item, in particular, will need some experienced 👀 on it. I suspect we may need to restore the test but with extra logic to account for wildcard. Also, this entire commit may be better being pulled into its own separate PR (although that could make manual testing quite tricky). ScreenshotsYou can now Group multiple different Block types together via:
|
Good progress.
Yes, this is something that we would like to do. This is the first transform that is applicable regardless of the block types involved. |
@aduth Thanks for the approving review! 🎉
I've created follow-on tasks as issues and noted these in your comments.
I will add this to the Core Editor meeting notes. I may not be able to attend due to family commitments. In which case it would be great if you could bring this up. |
Accidentally got lost during renaming of “UnGroup” to “Ungroup”!
Enables the ability register a given block as the block which handles “grouping” interactions within the editor. Related #14908
Can't wait to see this live. So excited about it! I've started working with groups in the past few days, and something like this will be amazing. |
This is a cool feature, thank you. Some thoughts: Perhaps I like the option to group under "More options" button on the block toolbar, but Transform to -> Group seems odd because intuitively transform should change the current block to something else. Ideally, instead of More options -> Group there could be More options -> Wrap that then allows to choose from any blocks whose InnerBlocks allow all currently selected blocks, Less ideally, I can register transforms for the Edit: Also More options -> Unwrap would be something that can't be easily done right now. |
…uping" interactions (#15774) * Adds grouping interaction to state Enables the ability register a given block as the block which handles “grouping” interactions within the editor. Related #14908 * Registers grouping block * Auto updated README * Adds test for get/set Grouping block * Update documentation with clearer descriptions * Adds reducer and selector tests * Updates “Blog” for correct “Block” in docs
@ktmn You are welcome. Glad you like it. 😄
Agreed, which is why I've added the ability to register your own Block as the Block to be used for "Grouping" #15774 This doesn't completely cover the use-case you outline. However, it will (once this PR is completed #16278) allow you to define (in code) which Block is actually used for the act of "Grouping". In theory, you'll then be able to register your own Block with Also, I'd advise that if you have a feature request you raise an Issue in this repo. This will ensure it is given visibility, as it was only by chance that I came across your comment on this PR. |
This is an experiment for one direction we might take for the abilityProvides the ability to group other Blocks within thecore/group
Block as per suggestion here.Closes #14601
Screenshots
📺 Here is a screencast of this in action.
Todos
transforms
definitions. Probably start herecore/group
is not availablecore/group
is not availablealign
widths of Blocks being grouped are respected and the appropriate width alignment set on thecore/group
so that layout is preserved when grouping.