Skip to content

v0.20.0

Compare
Choose a tag to compare
@matthewlipski matthewlipski released this 03 Dec 16:14
· 32 commits to main since this release

💖 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

Docs reference

getNextBlock

Docs reference

getParentBlock

Docs reference

setSelection

Docs reference

What's Changed

New Contributors

Full Changelog: v0.19.2...v0.20.0