An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: https://github.com/siyuan-note/siyuan/issues/17896
Danielf1ebddd54e74
diff --git a/app/src/protyle/undo/index.ts b/app/src/protyle/undo/index.tsindex e1c5c81b25..52e96ce7b2 100644--- a/app/src/protyle/undo/index.ts+++ b/app/src/protyle/undo/index.ts@@ -44,6 +44,11 @@ export class Undo {onTransaction(protyle, operations, true);document.querySelector(".av__panel")?.remove();preventScroll(protyle);+ // 同步 toolbar range,避免 undo/redo 替换 DOM 后 range 变为 detached,+ // 导致后续异步操作(如 F3 创建子文档)读到无效 range 而报错 https://github.com/siyuan-note/siyuan/issues/17896+ if (getSelection().rangeCount > 0) {+ protyle.toolbar.range = getSelection().getRangeAt(0);+ }}// add 降级为:不压栈(kernel 已在 commit 后 Record),仅置位本地镜像 + 刷新按钮态。diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 6b92a25e47..e7056181ab 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -1241,6 +1241,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {) {selectAll(protyle, nodeElement, range);}+ // 同步 toolbar.range,避免 DOM 已被其他操作(undo/enter 等)替换后变为 detached,+ // 导致后续异步回调中 setInlineMark 读到无效 range https://github.com/siyuan-note/siyuan/issues/17896+ protyle.toolbar.range = range;if (isNewNameFile) {fetchPost("/api/filetree/getHPathByPath", {notebook: protyle.notebookId,