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:
5
.changeset/twenty-papayas-vanish.md
Normal file
5
.changeset/twenty-papayas-vanish.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate-react': patch
|
||||
---
|
||||
|
||||
Don't treat events with non-selection target range as native
|
@@ -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 (
|
||||
|
Reference in New Issue
Block a user