v0.20.0
💖 Moving blocks as well as indentation & toolbar navigation changes have been sponsored by DINUM 🇫🇷 and ZenDiS 🇩🇪
💖 Table cell navigation changes have been sponsored by DeepOrigin💖
Moving blocks
moveBlocksUp
/moveBlocksDown
methods [Breaking]
The previously undocumented moveBlockUp
& moveBlockDown
methods have been renamed to moveBlocksUp
& moveBlocksDown
as they now support selections that span multiple blocks.
Additionally, their behaviour is now more inline with Notion and they now work better with "column"
and "columnList"
blocks from the @blocknote/xl-multi-column
package.
Docs have also been added for both methods.
Keyboard shortcuts
The Cmd+Shift+Up
/Cmd+Shift+Down
keyboard shortcuts (Ctrl+Shift+Up
/Ctrl+Shift+Down
for Windows) previously used the moveBlockUp
& moveBlockDown
methods, which are now moveBlocksUp
& moveBlocksDown
. This means that all the changes mentioned above also apply to those shortcuts.
Improved Tab
/Shift+Tab
handling
Indentation & toolbar navigation
Previously, while the formatting or link toolbars were open, Tab
& Shift+Tab
was used to navigate them for keyboard accessibility. In order to use Tab
/Shift+Tab
to indent/unindent the selected blocks, the user would have to first hit Escape
to close the toolbar(s). However, they would then immediately reopen, which would be frustrating when trying to move blocks up/down multiple nesting levels.
Now, the formatting and link toolbars remain closed after indenting/unindenting with Tab
/Shift+Tab
.
Additionally, setting the new tab-behaviour
editor option to "prefer-indent"
will cause Tab
/Shift+Tab
to always indent/unindent the selected blocks, regardless of any open toolbars. Note that this will make the toolbars no longer keyboard accessible.
Table cell navigation
Tab
/Shift+Tab
now navigate through cells when the selection is inside a table block, instead of indenting/unindenting the block.
Updated editor methods
getBlock
Previously could only get regular blocks, now also works with "column"
and "columnList"
blocks from the @blocknote/xl-multi-column
package.
getSelection
[Breaking]
Previously, getSelection().blocks
would return blocks spanned by the selection at all nesting levels, meaning the returned array would contain both a block and its descendants.
Now, in most cases, only blocks are added at the lowest nesting level of those spanned, though this works slightly differently when the block in which the selection starts is nested deeper than other blocks spanned. In either case, if a block is in the returned array, none of its descendants will be.
It's recommended to play around with the selected blocks demo or check the source code to understand the changes made to getSelection
in depth.
New editor methods
getPrevBlock
getNextBlock
getParentBlock
setSelection
What's Changed
- feat: Tab key handling for tables (simple) by @matthewlipski in #1275
- fix: Tab handling (indentation and toolbar focus) by @matthewlipski in #1285
- feat: Better selections and moving multiple blocks by @matthewlipski in #1276
- chore: upgrade y-prosemirror by @YousefED in #1301
- fix: delete file ru tooltip by @jurmaev in #1270
- fix: update max-height to inherit for suggestion menus by @andrewmnlv in #1282
- Typo fixing in examples by @tommerty in #1268
- fix: Placeholder error handling for inserting CSS rules by @matthewlipski in #1300
New Contributors
- @jurmaev made their first contribution in #1270
- @andrewmnlv made their first contribution in #1282
- @tommerty made their first contribution in #1268
Full Changelog: v0.19.2...v0.20.0