From 3562cc0bb162a96235a14a46a5c7804eb0502061 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 12 Oct 2024 12:51:15 +0800 Subject: [PATCH] :bug: https://github.com/siyuan-note/siyuan/issues/12753 --- app/src/protyle/util/selection.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts index 50473ae69..2d7b98949 100644 --- a/app/src/protyle/util/selection.ts +++ b/app/src/protyle/util/selection.ts @@ -317,9 +317,9 @@ export const setLastNodeRange = (editElement: Element, range: Range, setStart = // 最后一个为多种行内元素嵌套 lastNode = lastNode.lastChild as Element; } + // https://github.com/siyuan-note/siyuan/issues/12753 if (!lastNode) { - range.selectNodeContents(editElement); - return range; + lastNode = editElement; } if (setStart) { range.setStart(lastNode, lastNode.textContent.length);