feat(in-app-help): add dedicated icon for folders

This commit is contained in:
Elian Doran 2025-02-02 17:02:10 +02:00
parent 62dc11f9b8
commit 6215a21bae
No known key found for this signature in database

View File

@ -39,14 +39,20 @@ function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSubtreeIt
type: "doc",
attributes: []
};
let iconClass: string | undefined = undefined;
// Handle attributes
for (const attribute of noteMeta.attributes ?? []) {
if (attribute.name === "iconClass") {
item.attributes?.push(attribute);
iconClass = attribute.value;
}
}
// Handle folder notes
if (!noteMeta.dataFileName) {
iconClass = "bx bx-folder";
}
// Handle text notes
if (noteMeta.type === "text" && noteMeta.dataFileName) {
const docPath = `${docNameRoot}/${path.basename(noteMeta.dataFileName, ".html")}`
@ -58,6 +64,7 @@ function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSubtreeIt
});
}
// Handle children
if (noteMeta.children) {
const children: HiddenSubtreeItem[] = [];
for (const childMeta of noteMeta.children) {
@ -68,5 +75,14 @@ function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSubtreeIt
item.children = children;
}
// Handle note icon
if (iconClass) {
item.attributes?.push({
name: "iconClass",
value: iconClass,
type: "label"
});
}
return item;
}