1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-01 21:10:14 +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
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 ( if (
Element.isElement(currentNode) && Element.isElement(currentNode) &&
Editor.isVoid(editor, currentNode) && Editor.isVoid(editor, currentNode) &&
Editor.isInline(editor, currentNode) (Editor.isInline(editor, currentNode) ||
Editor.isBlock(editor, currentNode))
) { ) {
event.preventDefault() event.preventDefault()
Editor.deleteBackward(editor, { unit: 'block' }) Editor.deleteBackward(editor, { unit: 'block' })