An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: fix https://github.com/siyuan-note/siyuan/issues/5387
Vanessa0317de0f9f2b
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.tsindex 342492aca9..cd87f61822 100644--- a/app/src/protyle/util/selection.ts+++ b/app/src/protyle/util/selection.ts@@ -416,19 +416,23 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStarrange.selectNodeContents(element.firstElementChild);setRange = true;} else if (type === "NodeBlockQueryEmbed") {- if (element.lastElementChild.previousElementSibling) {- range.selectNodeContents(element.lastElementChild.previousElementSibling);+ if (element.lastElementChild.previousElementSibling?.firstChild) {+ range.selectNodeContents(element.lastElementChild.previousElementSibling.firstChild);+ range.collapse(true);} else {// https://github.com/siyuan-note/siyuan/issues/5267range.selectNodeContents(element);+ range.collapse(true);}setRange = true;} else if (["NodeMathBlock", "NodeHTMLBlock"].includes(type)) {- if (element.lastElementChild.previousElementSibling?.lastElementChild) {+ if (element.lastElementChild.previousElementSibling?.lastElementChild?.firstChild) {// https://ld246.com/article/1655714737572- range.selectNodeContents(element.lastElementChild.previousElementSibling.lastElementChild);+ range.selectNodeContents(element.lastElementChild.previousElementSibling.lastElementChild.firstChild);+ range.collapse(true);} else if (element.lastElementChild.previousElementSibling) {range.selectNodeContents(element.lastElementChild.previousElementSibling);+ range.collapse(true);}setRange = true;} else if (type === "NodeIFrame" || type === "NodeWidget") {@@ -442,6 +446,7 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStarsetRange = true;} else if (type === "NodeCodeBlock") {range.selectNodeContents(element);+ range.collapse(true);setRange = true;}if (setRange) {diff --git a/app/src/protyle/wysiwyg/remove.ts b/app/src/protyle/wysiwyg/remove.tsindex e8d0bc8b96..507c6362ed 100644--- a/app/src/protyle/wysiwyg/remove.ts+++ b/app/src/protyle/wysiwyg/remove.ts@@ -1,4 +1,4 @@-import {focusBlock, focusSideBlock, focusByWbr, focusByRange} from "../util/selection";+import {focusBlock, focusSideBlock, focusByWbr} from "../util/selection";import {getContenteditableElement,getLastBlock,@@ -14,7 +14,6 @@ import {setFold, zoomOut} from "../../menus/protyle";import {preventScroll} from "../scroll/preventScroll";import {hideElements} from "../ui/hideElements";import {Constants} from "../../constants";-import {countBlockWord} from "../../layout/status";const removeLi = (protyle: IProtyle, blockElement: Element, range: Range) => {if (!blockElement.parentElement.previousElementSibling && blockElement.parentElement.nextElementSibling && blockElement.parentElement.nextElementSibling.classList.contains("protyle-attr")) {@@ -412,10 +411,8 @@ export const removeBlock = (protyle: IProtyle, blockElement: Element, range: Ran}return;}- previousLastElement.classList.add("protyle-wysiwyg--select");- countBlockWord([previousId]);- if (previousLastElement.getAttribute("data-type") === "NodeBlockQueryEmbed" || editableElement.textContent !== "") {- focusByRange(range);+ focusBlock(previousLastElement, undefined, false);+ if (editableElement.textContent !== "") {return;}}