mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-15 19:54:02 +02:00
Fix deletion of expanded range (#4549)
This commit is contained in:
5
.changeset/modern-toes-invent.md
Normal file
5
.changeset/modern-toes-invent.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix deletion of expanded range (#4546)
|
@@ -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
|
// 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,
|
// to change the selection because it is the range that will be deleted,
|
||||||
// and those commands determine that for themselves.
|
// and those commands determine that for themselves.
|
||||||
@@ -424,7 +428,7 @@ export const Editable = (props: EditableProps) => {
|
|||||||
// Potentially expand to single character deletes, as well.
|
// Potentially expand to single character deletes, as well.
|
||||||
if (native) {
|
if (native) {
|
||||||
asNative(editor, () => Editor.insertText(editor, data), {
|
asNative(editor, () => Editor.insertText(editor, data), {
|
||||||
onFlushed: () => (native = false),
|
onFlushed: () => event.preventDefault(),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Editor.insertText(editor, data)
|
Editor.insertText(editor, data)
|
||||||
@@ -434,10 +438,6 @@ export const Editable = (props: EditableProps) => {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!native) {
|
|
||||||
event.preventDefault()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[readOnly, propsOnDOMBeforeInput]
|
[readOnly, propsOnDOMBeforeInput]
|
||||||
|
Reference in New Issue
Block a user