Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/5267

Vanessa84a2e5380caa
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 398072b395..07b88bc965 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -409,12 +409,17 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar
if (type === "NodeThematicBreak") {
range.selectNodeContents(element.firstElementChild);
setRange = true;
- } else if (type === "NodeBlockQueryEmbed" && element.lastElementChild.previousElementSibling) {
- range.selectNodeContents(element.lastElementChild.previousElementSibling);
+ } else if (type === "NodeBlockQueryEmbed") {
+ if (element.lastElementChild.previousElementSibling) {
+ range.selectNodeContents(element.lastElementChild.previousElementSibling);
+ } else {
+ // https://github.com/siyuan-note/siyuan/issues/5267
+ range.selectNodeContents(element);
+ }
setRange = true;
} else if (["NodeMathBlock", "NodeHTMLBlock"].includes(type)) {
- // https://ld246.com/article/1655714737572
if (element.lastElementChild.previousElementSibling?.lastElementChild) {
+ // https://ld246.com/article/1655714737572
range.selectNodeContents(element.lastElementChild.previousElementSibling.lastElementChild);
} else if (element.lastElementChild.previousElementSibling) {
range.selectNodeContents(element.lastElementChild.previousElementSibling);