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

Don't treat events with non-selection target range as native (#4957)

This commit is contained in:
Eric Meier
2022-04-20 17:47:38 -04:00
committed by GitHub
parent f362cd7a19
commit c1e3fbaab9
2 changed files with 11 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
---
'slate-react': patch
---
Don't treat events with non-selection target range as native

View File

@@ -390,10 +390,6 @@ 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.
@@ -407,6 +403,8 @@ export const Editable = (props: EditableProps) => {
})
if (!selection || !Range.equals(selection, range)) {
native = false
const selectionRef =
editor.selection && Editor.rangeRef(editor, editor.selection)
@@ -419,6 +417,10 @@ export const Editable = (props: EditableProps) => {
}
}
if (!native) {
event.preventDefault()
}
// COMPAT: If the selection is expanded, even if the command seems like
// a delete forward/backward command it should delete the selection.
if (