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 document tree state after converting headings to documents https://github.com/siyuan-note/siyuan/issues/19734
Daniel8abb992da437
diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.tsindex d397470849..d79f63e3b1 100644--- a/app/src/layout/dock/Files.ts+++ b/app/src/layout/dock/Files.ts@@ -1348,19 +1348,18 @@ export class Files extends Model {let currentPath = filePath;let liElement;while (!liElement) {- liElement = treeElement.querySelector(`[data-path="${currentPath}"]`);- if (!liElement) {- const dirname = pathPosix().dirname(currentPath);- if (dirname === "/") {- const rootElement = treeElement.firstElementChild as HTMLElement;- if (rootElement.querySelector(".b3-list-item__arrow--open")) {- this.getLeaf(rootElement, notebookId, true);- }- break;- } else {- currentPath = dirname + ".sy";+ // 新文档只影响父级的子文档状态,从父路径开始查找。+ const dirname = pathPosix().dirname(currentPath);+ if (dirname === "/") {+ const rootElement = treeElement.firstElementChild as HTMLElement;+ if (rootElement.querySelector(".b3-list-item__arrow--open")) {+ this.getLeaf(rootElement, notebookId, true);}- } else {+ break;+ }+ currentPath = dirname + ".sy";+ liElement = treeElement.querySelector(`[data-path="${currentPath}"]`);+ if (liElement) {const hiddenElement = liElement.querySelector(".fn__hidden");if (hiddenElement) {// 原先无子文档:显示展开箭头diff --git a/app/src/mobile/dock/MobileFiles.ts b/app/src/mobile/dock/MobileFiles.tsindex c4605bd1ec..92ebfa70dc 100644--- a/app/src/mobile/dock/MobileFiles.ts+++ b/app/src/mobile/dock/MobileFiles.ts@@ -840,19 +840,18 @@ export class MobileFiles extends Model {let currentPath = filePath;let liElement;while (!liElement) {- liElement = treeElement.querySelector(`[data-path="${currentPath}"]`);- if (!liElement) {- const dirname = pathPosix().dirname(currentPath);- if (dirname === "/") {- const rootElement = treeElement.firstElementChild as HTMLElement;- if (rootElement.querySelector(".b3-list-item__arrow--open")) {- this.getLeaf(rootElement, notebookId, true);- }- break;- } else {- currentPath = dirname + ".sy";+ // 新文档只影响父级的子文档状态,从父路径开始查找。+ const dirname = pathPosix().dirname(currentPath);+ if (dirname === "/") {+ const rootElement = treeElement.firstElementChild as HTMLElement;+ if (rootElement.querySelector(".b3-list-item__arrow--open")) {+ this.getLeaf(rootElement, notebookId, true);}- } else {+ break;+ }+ currentPath = dirname + ".sy";+ liElement = treeElement.querySelector(`[data-path="${currentPath}"]`);+ if (liElement) {const hiddenElement = liElement.querySelector(".fn__hidden");if (hiddenElement) {// 原先无子文档:显示展开箭头