From 64f194ee224368ef8acffcd6f881e58341b76cab Mon Sep 17 00:00:00 2001 From: V_Lute <751356316@qq.com> Date: Sat, 29 Jan 2022 00:33:57 +0800 Subject: [PATCH] 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 --- src/transforms/text.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/transforms/text.ts b/src/transforms/text.ts index 1c8e877b43..2fc90dbea0 100644 --- a/src/transforms/text.ts +++ b/src/transforms/text.ts @@ -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 })