Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/14255

Daniel020dfabcb005
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 252b5791b1..00ca1b7362 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)) {