From 7c455e695cba4fe95c5b6f898f620a26731abfc4 Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Sun, 14 Jan 2024 12:52:28 +0100 Subject: [PATCH] Option to hide collapse indicator when folder only has a folder note and nothing else --- manifest.json | 2 +- src/main.ts | 1 + src/settings/FileExplorerSettings.ts | 17 +++++++++++++++++ src/settings/SettingsTab.ts | 2 ++ styles.css | 2 +- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index caed8b1..2913639 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-notes", "name": "Folder notes", - "version": "1.7.4", + "version": "1.7.5", "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/main.ts b/src/main.ts index a983f31..9233b30 100644 --- a/src/main.ts +++ b/src/main.ts @@ -37,6 +37,7 @@ export default class FolderNotesPlugin extends Plugin { if (this.settings.cursiveNameInPath) { document.body.classList.add('folder-note-cursive-path'); } if (this.settings.underlineFolderInPath) { document.body.classList.add('folder-note-underline-path'); } if (!this.settings.allowWhitespaceCollapsing) { document.body.classList.add('fn-whitespace-stop-collapsing'); } + if (this.settings.hideCollapsingIcon) { document.body.classList.add('fn-hide-collapse-icon'); } new Commands(this.app, this).registerCommands(); diff --git a/src/settings/FileExplorerSettings.ts b/src/settings/FileExplorerSettings.ts index 7cd333e..7410500 100644 --- a/src/settings/FileExplorerSettings.ts +++ b/src/settings/FileExplorerSettings.ts @@ -100,6 +100,23 @@ export async function renderFileExplorer(settingsTab: SettingsTab) { settingsTab.settingsPage.createEl('h3', { text: 'Style settings' }); + new Setting(containerEl) + .setName('Hide collapse icon') + .setDesc('Hide the collapse icon in the file explorer next to the name of a folder when a folder only contains a folder note') + .addToggle((toggle) => + toggle + .setValue(settingsTab.plugin.settings.hideCollapsingIcon) + .onChange(async (value) => { + settingsTab.plugin.settings.hideCollapsingIcon = value; + await settingsTab.plugin.saveSettings(); + if (value) { + document.body.classList.add('fn-hide-collapse-icon'); + } else { + document.body.classList.remove('fn-hide-collapse-icon'); + } + }) + ); + new Setting(containerEl) .setName('Underline the name of folder notes') .setDesc('Add an underline to folders that have a folder note in the file explorer') diff --git a/src/settings/SettingsTab.ts b/src/settings/SettingsTab.ts index 43d3446..8c4eeff 100644 --- a/src/settings/SettingsTab.ts +++ b/src/settings/SettingsTab.ts @@ -51,6 +51,7 @@ export interface FolderNotesSettings { openWithAlt: boolean; excludeFolderDefaultSettings: ExcludedFolder; excludePatternDefaultSettings: ExcludePattern; + hideCollapsingIcon: boolean; } export const DEFAULT_SETTINGS: FolderNotesSettings = { @@ -133,6 +134,7 @@ export const DEFAULT_SETTINGS: FolderNotesSettings = { excludeFromFolderOverview: false, string: '', }, + hideCollapsingIcon: false, }; export class SettingsTab extends PluginSettingTab { diff --git a/styles.css b/styles.css index c0dccae..596966c 100644 --- a/styles.css +++ b/styles.css @@ -232,7 +232,7 @@ body:not(.is-grabbing) .tree-item-self.fn-is-active:hover, font-style: italic; } -.only-has-folder-note .tree-item-icon { +.fn-hide-collapse-icon .only-has-folder-note .tree-item-icon { display: none; }