From 020dfabcb005eefcf611f064752831f93219a4c7 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 11 Mar 2025 12:30:17 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14255 --- 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 252b5791b..00ca1b736 100644 --- a/app/src/protyle/util/selection.ts +++ b/app/src/protyle/util/selection.ts @@ -392,7 +392,7 @@ export const focusByOffset = (container: Element, start: number, end: number, is const editElement = getContenteditableElement(container); if (editElement) { container = editElement; - } else if (isNotEditBlock(container) || container.classList.contains("av")) { + } else if (isFocus && (isNotEditBlock(container) || container.classList.contains("av"))) { return focusBlock(container); } let startNode; @@ -549,7 +549,7 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar setRange = true; } else if (type === "NodeBlockQueryEmbed") { genRenderFrame(element); - range.selectNodeContents(element.lastElementChild.previousElementSibling.firstChild); + range.setStart(element.lastElementChild.previousElementSibling.firstChild, 0); range.collapse(true); setRange = true; } else if (["NodeMathBlock", "NodeHTMLBlock"].includes(type)) {