mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-05 06:47:26 +02:00
update insertText logic when selection is not collapsed (#4804)
* update insertText logic when selection is not collapsed * add changeset * fix bug when end of range is void Co-authored-by: zhangpengcheng15 <zhangpengcheng15@jd.com>
This commit is contained in:
5
.changeset/silly-flowers-worry.md
Normal file
5
.changeset/silly-flowers-worry.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
update insertText logic when selection is not collapsed
|
@@ -484,12 +484,11 @@ export const TextTransforms: TextTransforms = {
|
|||||||
at = at.anchor
|
at = at.anchor
|
||||||
} else {
|
} else {
|
||||||
const end = Range.end(at)
|
const end = Range.end(at)
|
||||||
|
|
||||||
if (!voids && Editor.void(editor, { at: end })) {
|
if (!voids && Editor.void(editor, { at: end })) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const start = Range.start(at)
|
||||||
const pointRef = Editor.pointRef(editor, end)
|
const pointRef = Editor.pointRef(editor, start)
|
||||||
Transforms.delete(editor, { at, voids })
|
Transforms.delete(editor, { at, voids })
|
||||||
at = pointRef.unref()!
|
at = pointRef.unref()!
|
||||||
Transforms.setSelection(editor, { anchor: at, focus: at })
|
Transforms.setSelection(editor, { anchor: at, focus: at })
|
||||||
|
Reference in New Issue
Block a user