Add always to collapse to folder overview settings

This commit is contained in:
Lost Paul 2024-12-28 17:55:48 +01:00
parent 69a1318442
commit 2bf6c26fb2

View file

@ -37,6 +37,7 @@ export class FolderOverviewSettings extends Modal {
storeFolderCondition: yaml?.storeFolderCondition === undefined || yaml?.storeFolderCondition === null ? plugin.settings.defaultOverview.storeFolderCondition : yaml?.storeFolderCondition,
showFolderNotes: yaml?.showFolderNotes === undefined || yaml?.showFolderNotes === null ? plugin.settings.defaultOverview.showFolderNotes : yaml?.showFolderNotes,
disableCollapseIcon: yaml?.disableCollapseIcon === undefined || yaml?.disableCollapseIcon === null ? plugin.settings.defaultOverview.disableCollapseIcon : yaml?.disableCollapseIcon,
alwaysCollapse: yaml?.alwaysCollapse === undefined || yaml?.alwaysCollapse === null ? plugin.settings.defaultOverview.alwaysCollapse : yaml?.alwaysCollapse,
}
}
if (ctx) {
@ -342,6 +343,21 @@ export class FolderOverviewSettings extends Modal {
await updateYaml(this.plugin, this.ctx, this.el, this.yaml);
});
});
new Setting(contentEl)
.setName('Collapse all in the tree by default')
.setDesc('Collapse every folder in the file explorer in the overview by default')
.addToggle((toggle) => {
toggle
.setValue(this.yaml.alwaysCollapse)
.onChange(async (value) => {
this.yaml.alwaysCollapse = value;
if (this.defaultSettings) {
return this.plugin.saveSettings();
}
await updateYaml(this.plugin, this.ctx, this.el, this.yaml);
});
});
}
}