1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-14 11:14:04 +02:00

Fix deletion of expanded range (#4549)

This commit is contained in:
Nemanja Tosic
2021-09-26 17:05:52 +02:00
committed by GitHub
parent 95e13b0be1
commit f9c41a569c
2 changed files with 10 additions and 5 deletions

View File

@@ -310,6 +310,10 @@ export const Editable = (props: EditableProps) => {
}
}
if (!native) {
event.preventDefault()
}
// COMPAT: For the deleting forward/backward input types we don't want
// to change the selection because it is the range that will be deleted,
// and those commands determine that for themselves.
@@ -424,7 +428,7 @@ export const Editable = (props: EditableProps) => {
// Potentially expand to single character deletes, as well.
if (native) {
asNative(editor, () => Editor.insertText(editor, data), {
onFlushed: () => (native = false),
onFlushed: () => event.preventDefault(),
})
} else {
Editor.insertText(editor, data)
@@ -434,10 +438,6 @@ export const Editable = (props: EditableProps) => {
break
}
}
if (!native) {
event.preventDefault()
}
}
},
[readOnly, propsOnDOMBeforeInput]