From 01d10929a7d6cd29f4c1cf5e6d622fe560da98b1 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Wed, 26 Mar 2025 22:16:36 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/14405 --- 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 8cae0b895..e6dcbaca3 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") {