diff --git a/manifest.json b/manifest.json index 6099c38..662bd23 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-notes", "name": "Folder notes", - "version": "1.4.0", + "version": "1.4.1", "minAppVersion": "0.15.0", "description": "Create notes within folders that can be accessed without collapsing the folder, similar to the functionality offered in Notion.", "author": "Lost Paul", diff --git a/src/folderOverview.ts b/src/folderOverview.ts index 94d853a..1293624 100644 --- a/src/folderOverview.ts +++ b/src/folderOverview.ts @@ -5,7 +5,7 @@ export type yamlSettings = { title?: string; disableTitle?: boolean; depth?: number; - type?: 'folder' | 'markdown' | 'canvas' | 'other' | 'pdf' | 'images' | 'audio' | 'video'; + type?: 'folder' | 'markdown' | 'canvas' | 'other' | 'pdf' | 'images' | 'audio' | 'video' | 'all'; includeTypes?: string[]; style?: 'list' | 'grid'; disableFileTag?: boolean; @@ -243,7 +243,7 @@ function addFolderList(plugin: FolderNotesPlugin, list: HTMLUListElement | HTMLL } function addFileList(plugin: FolderNotesPlugin, list: HTMLUListElement | HTMLLIElement, pathBlacklist: string[], file: TFile, includeTypes: string[], disableFileTag: boolean) { - if (includeTypes.length > 0) { + if (includeTypes.length > 0 && !includeTypes.includes('all')) { if (file.extension === 'md' && !includeTypes.includes('markdown')) return; if (file.extension === 'canvas' && !includeTypes.includes('canvas')) return; if (file.extension === 'pdf' && !includeTypes.includes('pdf')) return; diff --git a/src/modals/folderOverview.ts b/src/modals/folderOverview.ts index 86fab0e..c748b0a 100644 --- a/src/modals/folderOverview.ts +++ b/src/modals/folderOverview.ts @@ -76,7 +76,7 @@ export class FolderOverviewSettings extends Modal { .setValues(this.yaml?.includeTypes || this.plugin.settings.defaultOverview.includeTypes || []) .addResetButton() ); - if ((this.yaml?.includeTypes?.length || 0) < 8) { + if ((this.yaml?.includeTypes?.length || 0) < 8 && !this.yaml.includeTypes?.includes('all')) { setting.addDropdown((dropdown) => { if (!this.yaml.includeTypes) this.yaml.includeTypes = this.plugin.settings.defaultOverview.includeTypes || []; this.yaml.includeTypes = this.yaml.includeTypes.map((type: string) => type.toLowerCase()); @@ -89,6 +89,7 @@ export class FolderOverviewSettings extends Modal { { value: 'audio', label: 'Audio' }, { value: 'video', label: 'Video' }, { value: 'other', label: 'All other file types' }, + { value: 'all', label: 'All file types' }, ]; options.forEach((option) => { @@ -99,6 +100,11 @@ export class FolderOverviewSettings extends Modal { dropdown.addOption('+', '+'); dropdown.setValue('+'); dropdown.onChange(async (value) => { + if (value === 'all') { + this.yaml.includeTypes = this.yaml.includeTypes?.filter((type: string) => type === 'folder'); + // @ts-ignore + list.setValues(this.yaml.includeTypes); + } // @ts-ignore await list.addValue(value.toLowerCase()); await this.updateYaml(); @@ -177,6 +183,7 @@ export class FolderOverviewSettings extends Modal { .onChange(async (value) => { this.yaml.showEmptyFolders = value; this.yaml.onlyIncludeSubfolders = false; + this.display(); await this.updateYaml(); }); });