Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Blocks: Add blocks "slash" autocomplete on default block #2630
This pull request seeks to enable a user to add a block by typing a slash
There's a bit of reinventing the wheel here, but unfortunately I wasn't able to reuse very much:
There may still be opportunity for refactoring to consolidate some of these behaviors.
Verify that you can insert a new block from an empty paragraph block by typing slash, followed by a block search.
@@ Coverage Diff @@ ## master #2630 +/- ## ========================================== + Coverage 31.31% 32.23% +0.92% ========================================== Files 178 181 +3 Lines 5429 5525 +96 Branches 949 968 +19 ========================================== + Hits 1700 1781 +81 - Misses 3154 3166 +12 - Partials 575 578 +3
Ideally, I think this should show the new block as selected after making a replacement. In fact, it is selected, but the
Really good job, works great.
I also see a lot of refactor opportunities:
I think we can use the
Popovercomponent and avoid following the cursor position (That's how slack work)
dropdowncomponent should probably be splitted, and reused accross different places (FormtTokenField, Autocomplete, Table Block, Switcher)
Made some updates to reuse the
I'm postponing the accessibility changes, because this component is a bit "special". my question here is: Should we add all these combobox attributes knowing that this component won't behave as an autocomplete component if we do not type "/". It's just the paragraph block. I was thinking adding these attributes could be confusing. @afercia
Anyway, I think we can merge this and address the remaining reusability and accessibility issues separately.
First, really enjoying using this! Great work everyone on this.
I did find one thing that maybe is more of a 'tweak' than a bug. If you do the following:
I can see a possible user flow of changing blocks through the slash command. Is this expected or a bug?
Sep 5, 2017
Just tested and well, I guess you know the answer