Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/16206

Vanessa1e60748e640a
diff --git a/app/src/util/Tree.ts b/app/src/util/Tree.ts
index a52fa928f5..8c35ed4fb7 100644
--- a/app/src/util/Tree.ts
+++ b/app/src/util/Tree.ts
@@ -54,7 +54,7 @@ export class Tree {
}
}
- private genHTML(data: IBlockTree[]) {
+ private genHTML(data: (IBlockTree & { folded?: boolean })[]) {
let html = `<ul${data[0].depth === 0 ? " class='b3-list b3-list--background'" : ""}>`;
data.forEach((item) => {
let titleTip = "";
@@ -94,7 +94,7 @@ data-type="${item.nodeType}"
data-subtype="${item.subType}"
${item.label ? "data-label='" + item.label + "'" : ""}>
<span style="${style}" class="b3-list-item__toggle${showArrow ? " b3-list-item__toggle--hl" : ""}${showArrow ? "" : " fn__hidden"}">
- <svg data-id="${item.id || encodeURIComponent(item.name + item.depth)}" class="b3-list-item__arrow${hasChild ? " b3-list-item__arrow--open" : ""}"><use xlink:href="#iconRight"></use></svg>
+ <svg data-id="${item.id || encodeURIComponent(item.name + item.depth)}" class="b3-list-item__arrow${(item.type === "outline" ? !item.folded : hasChild) ? " b3-list-item__arrow--open" : ""}"><use xlink:href="#iconRight"></use></svg>
</span>
${iconHTML}
<span class="b3-list-item__text ariaLabel" data-position="parentE"${titleTip}>${item.name}</span>
@@ -105,7 +105,7 @@ ${item.label ? "data-label='" + item.label + "'" : ""}>
html += this.genHTML(item.children) + "</ul>";
}
if (item.blocks && item.blocks.length > 0) {
- html += this.genBlockHTML(item.blocks, true, item.type) + "</ul>";
+ html += this.genBlockHTML(item.blocks, item.type === "outline" ? !item.folded : true, item.type) + "</ul>";
}
});
return html;
@@ -153,7 +153,7 @@ data-subtype="${item.subType}"
data-treetype="${type}"
data-def-path="${item.defPath}">
<span style="${style}" class="b3-list-item__toggle${item.children ? " b3-list-item__toggle--hl" : ""}${item.children ? "" : " fn__hidden"}">
- <svg data-id="${item.id}" class="b3-list-item__arrow${(type === "outline" && !item.folded) ? " b3-list-item__arrow--open" : ""}"><use xlink:href="#iconRight"></use></svg>
+ <svg data-id="${item.id}" class="b3-list-item__arrow${(type === "outline" ? !item.folded : show) ? " b3-list-item__arrow--open" : ""}"><use xlink:href="#iconRight"></use></svg>
</span>
${iconHTML}
<span class="b3-list-item__text ariaLabel" data-position="parentE" ${type === "outline" ? ' aria-label="' + escapeAriaLabel(Lute.BlockDOM2Content(item.content)) + '"' : ""}>${item.content}</span>
@@ -161,7 +161,7 @@ data-def-path="${item.defPath}">
${this.blockExtHTML || ""}
</li>`;
if (item.children && item.children.length > 0) {
- html += this.genBlockHTML(item.children, (type === "outline" && !item.folded) ? true : false, type) + "</ul>";
+ html += this.genBlockHTML(item.children, type === "outline" ? !item.folded : false, type) + "</ul>";
}
});
return html;