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/14405

Vanessa01d10929a7d6
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 8cae0b895e..e6dcbaca3c 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -176,7 +176,7 @@ export const getEditorRange = (element: Element): Range => {
if (type === "NodeThematicBreak") {
targetElement = element.firstElementChild;
} else if (type === "NodeBlockQueryEmbed") {
- targetElement = element.lastElementChild.previousElementSibling?.firstChild;
+ targetElement = element.querySelector(".protyle-cursor")?.firstChild;
} else if (["NodeMathBlock", "NodeHTMLBlock"].includes(type)) {
targetElement = element.lastElementChild.previousElementSibling?.lastElementChild?.firstChild;
} else if (type === "NodeVideo") {
@@ -571,7 +571,7 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
setRange = true;
} else if (type === "NodeBlockQueryEmbed") {
genRenderFrame(element);
- range.setStart(element.lastElementChild.previousElementSibling.firstChild, 0);
+ range.setStart(element.querySelector(".protyle-cursor").firstChild, 0);
range.collapse(true);
setRange = true;
} else if (type === "NodeMathBlock") {