BlockNote
BlockNote copied to clipboard
fix: Missing Delete key handlers
Summary
This PR adds some additional handling for the Delete key that already exists for the Backspace key.
Rationale
MacOS keyboards don't relaly have a delete key, but Windows keyboards do and it's a fairly commonly used key, so it makes sense to have better support for it.
Changes
- Cleaned up handler for merging blocks, when Delete is pressed at the end of a block with inline content while the next block also has inline content.
- Added handler for deleting the current block and moving the selection to the start of the next one, when Delete is pressed in an empty block.
- Added handler for deleting the next block, if it has no content and isn't a table. If that block has children, they are lifted out.
- Added
getNextBlockInfohelper.
Impact
N/A
Testing
TODO? We also have pretty limited tests for Backspace handling. I'm a bit hesitant to add them though as they would currently have to be e2e tests, so would prefer to set up component testing first.
Screenshots/Video
N/A
Checklist
- [X] Code follows the project's coding standards.
- [X] Unit tests covering the new feature have been added.
- [X] All existing tests pass.
- [X] The documentation has been updated to reflect the new feature