mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-03 13:57:25 +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
|
||||
} else {
|
||||
const end = Range.end(at)
|
||||
|
||||
if (!voids && Editor.void(editor, { at: end })) {
|
||||
return
|
||||
}
|
||||
|
||||
const pointRef = Editor.pointRef(editor, end)
|
||||
const start = Range.start(at)
|
||||
const pointRef = Editor.pointRef(editor, start)
|
||||
Transforms.delete(editor, { at, voids })
|
||||
at = pointRef.unref()!
|
||||
Transforms.setSelection(editor, { anchor: at, focus: at })
|
||||
|
Reference in New Issue
Block a user