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: fix https://github.com/siyuan-note/siyuan/issues/5051
Vanessa28e220b066d6
diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex caa451f6f5..8e153b29a1 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -439,23 +439,27 @@ const updateOutline = (models: IModels, protyle: IProtyle, reload = false) => {fetchPost("/api/outline/getDocOutline", {id: blockId,}, response => {- item.updateDocTitle(protyle.title.editElement.textContent);item.update(response, blockId);- if (protyle && getSelection().rangeCount > 0) {- const startContainer = getSelection().getRangeAt(0).startContainer;- if (protyle.wysiwyg.element.contains(startContainer)) {- const currentElement = hasClosestByAttribute(startContainer, "data-node-id", null);- if (currentElement) {- if (currentElement.getAttribute("data-type") === "NodeHeading") {- item.setCurrent(currentElement.getAttribute("data-node-id"));- } else {- const headingElement = getPreviousHeading(currentElement);- if (headingElement) {- item.setCurrent(headingElement.getAttribute("data-node-id"));+ if (protyle) {+ item.updateDocTitle(protyle.title.editElement.textContent);+ if (getSelection().rangeCount > 0) {+ const startContainer = getSelection().getRangeAt(0).startContainer;+ if (protyle.wysiwyg.element.contains(startContainer)) {+ const currentElement = hasClosestByAttribute(startContainer, "data-node-id", null);+ if (currentElement) {+ if (currentElement.getAttribute("data-type") === "NodeHeading") {+ item.setCurrent(currentElement.getAttribute("data-node-id"));+ } else {+ const headingElement = getPreviousHeading(currentElement);+ if (headingElement) {+ item.setCurrent(headingElement.getAttribute("data-node-id"));+ }}}}}+ } else {+ item.updateDocTitle();}});return;