mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Sort by option
This commit is contained in:
parent
46c529610c
commit
8e7ac4a589
1 changed files with 30 additions and 0 deletions
|
|
@ -15,6 +15,18 @@ export class FolderOverviewSettings extends Modal {
|
|||
this.yaml = yaml;
|
||||
this.ctx = ctx;
|
||||
this.el = el;
|
||||
if (!this.yaml) {
|
||||
this.yaml = {
|
||||
title: this.plugin.settings.defaultOverview.title,
|
||||
disableTitle: this.plugin.settings.defaultOverview.disableTitle,
|
||||
depth: this.plugin.settings.defaultOverview.depth,
|
||||
type: this.plugin.settings.defaultOverview.type,
|
||||
includeTypes: this.plugin.settings.defaultOverview.includeTypes,
|
||||
style: this.plugin.settings.defaultOverview.style,
|
||||
disableCanvasTag: this.plugin.settings.defaultOverview.disableCanvasTag,
|
||||
sortBy: this.plugin.settings.defaultOverview.sortBy,
|
||||
};
|
||||
}
|
||||
}
|
||||
onOpen() {
|
||||
this.display();
|
||||
|
|
@ -125,6 +137,24 @@ export class FolderOverviewSettings extends Modal {
|
|||
})
|
||||
);
|
||||
|
||||
new Setting(contentEl)
|
||||
.setName('Sort files by')
|
||||
.setDesc('Choose how the files should be sorted')
|
||||
.addDropdown((dropdown) =>
|
||||
dropdown
|
||||
.addOption('name', 'Name descending')
|
||||
.addOption('created', 'Created descending')
|
||||
.addOption('modified', 'Modified descending')
|
||||
.addOption('nameAsc', 'Name ascending')
|
||||
.addOption('createdAsc', 'Created ascending')
|
||||
.addOption('modifiedAsc', 'Modified ascending')
|
||||
.setValue(this.yaml?.sortBy || 'name')
|
||||
.onChange(async (value: 'name' | 'created' | 'modified' | 'nameAsc' | 'createdAsc' | 'modifiedAsc') => {
|
||||
this.yaml.sortBy = value;
|
||||
await this.updateYaml();
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
onClose() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue