mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-19 00:42:29 +08:00
feat(in-app-help): add dedicated icon for folders
This commit is contained in:
parent
62dc11f9b8
commit
6215a21bae
@ -39,14 +39,20 @@ function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSubtreeIt
|
|||||||
type: "doc",
|
type: "doc",
|
||||||
attributes: []
|
attributes: []
|
||||||
};
|
};
|
||||||
|
let iconClass: string | undefined = undefined;
|
||||||
|
|
||||||
// Handle attributes
|
// Handle attributes
|
||||||
for (const attribute of noteMeta.attributes ?? []) {
|
for (const attribute of noteMeta.attributes ?? []) {
|
||||||
if (attribute.name === "iconClass") {
|
if (attribute.name === "iconClass") {
|
||||||
item.attributes?.push(attribute);
|
iconClass = attribute.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle folder notes
|
||||||
|
if (!noteMeta.dataFileName) {
|
||||||
|
iconClass = "bx bx-folder";
|
||||||
|
}
|
||||||
|
|
||||||
// Handle text notes
|
// Handle text notes
|
||||||
if (noteMeta.type === "text" && noteMeta.dataFileName) {
|
if (noteMeta.type === "text" && noteMeta.dataFileName) {
|
||||||
const docPath = `${docNameRoot}/${path.basename(noteMeta.dataFileName, ".html")}`
|
const docPath = `${docNameRoot}/${path.basename(noteMeta.dataFileName, ".html")}`
|
||||||
@ -58,6 +64,7 @@ function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSubtreeIt
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle children
|
||||||
if (noteMeta.children) {
|
if (noteMeta.children) {
|
||||||
const children: HiddenSubtreeItem[] = [];
|
const children: HiddenSubtreeItem[] = [];
|
||||||
for (const childMeta of noteMeta.children) {
|
for (const childMeta of noteMeta.children) {
|
||||||
@ -68,5 +75,14 @@ function parseNoteMeta(noteMeta: NoteMeta, docNameRoot: string): HiddenSubtreeIt
|
|||||||
item.children = children;
|
item.children = children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle note icon
|
||||||
|
if (iconClass) {
|
||||||
|
item.attributes?.push({
|
||||||
|
name: "iconClass",
|
||||||
|
value: iconClass,
|
||||||
|
type: "label"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user