1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-21 13:51:59 +02:00

Make it possible to delete block elements with backspace on Chrome and Safari (#5123)

* Make it possible to delete block elements with backspace in chrome and safari

* Add changeset
This commit is contained in:
Laufey Rut Guðmundsdóttir 2022-09-20 21:22:24 +00:00 committed by GitHub
parent 341041f0b7
commit 0eb37e7915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
'slate-react': minor
---
Make it possible to delete block elements with backspace in Chrome and Safari

View File

@ -1561,7 +1561,8 @@ export const Editable = (props: EditableProps) => {
if (
Element.isElement(currentNode) &&
Editor.isVoid(editor, currentNode) &&
Editor.isInline(editor, currentNode)
(Editor.isInline(editor, currentNode) ||
Editor.isBlock(editor, currentNode))
) {
event.preventDefault()
Editor.deleteBackward(editor, { unit: 'block' })