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

fixed cursor when we triple click on text and type over it #4862 (#4868)

* fixed cursor when we triple click on text and type over it

* fixed

* fixed

* Add changeset

Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
This commit is contained in:
yongzs
2022-03-07 18:58:34 +08:00
committed by GitHub
parent 53f47b01d1
commit 7499d4b4c0
2 changed files with 12 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
'slate-react: patch
---
fixed cursor when triple clicking on text and type over it, fixes #4862

View File

@@ -483,6 +483,13 @@ export const Editable = (props: EditableProps) => {
case 'insertFromYank':
case 'insertReplacementText':
case 'insertText': {
const { selection } = editor
if (selection) {
if (Range.isExpanded(selection)) {
Editor.deleteFragment(editor)
}
}
if (type === 'insertFromComposition') {
// COMPAT: in Safari, `compositionend` is dispatched after the
// `beforeinput` for "insertFromComposition". But if we wait for it