From 3673e6c0e2f199e4db1fb1b624a657dba65ae65d Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Sun, 2 Jun 2024 14:36:07 +0200 Subject: [PATCH] Option to disable folder highlighting --- src/main.ts | 1 + src/settings/FileExplorerSettings.ts | 17 +++++++++++++++++ src/settings/SettingsTab.ts | 4 +++- styles.css | 2 +- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 7663f73..a16500d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -44,6 +44,7 @@ export default class FolderNotesPlugin extends Plugin { if (this.settings.underlineFolderInPath) { document.body.classList.add('folder-note-underline-path'); } if (this.settings.stopWhitespaceCollapsing) { document.body.classList.add('fn-whitespace-stop-collapsing'); } if (this.settings.hideCollapsingIcon) { document.body.classList.add('fn-hide-collapse-icon'); } + if (!this.settings.highlightFolder) { document.body.classList.add('disable-folder-highlight'); } new Commands(this.app, this).registerCommands(); diff --git a/src/settings/FileExplorerSettings.ts b/src/settings/FileExplorerSettings.ts index 85a93d5..d861437 100644 --- a/src/settings/FileExplorerSettings.ts +++ b/src/settings/FileExplorerSettings.ts @@ -99,6 +99,23 @@ export async function renderFileExplorer(settingsTab: SettingsTab) { settingsTab.settingsPage.createEl('h3', { text: 'Style settings' }); + new Setting(containerEl) + .setName('Highlight folder in the file explorer') + .setDesc('Highlight the folder name in the file explorer when you click on a folder that has a folder note') + .addToggle((toggle) => + toggle + .setValue(settingsTab.plugin.settings.highlightFolder) + .onChange(async (value) => { + settingsTab.plugin.settings.highlightFolder = value; + if (!value) { + document.body.classList.add('disable-folder-highlight'); + } else { + document.body.classList.remove('disable-folder-highlight'); + } + await settingsTab.plugin.saveSettings(); + }) + ); + 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') diff --git a/src/settings/SettingsTab.ts b/src/settings/SettingsTab.ts index 2f84b4b..e3b8f56 100644 --- a/src/settings/SettingsTab.ts +++ b/src/settings/SettingsTab.ts @@ -65,6 +65,7 @@ export interface FolderNotesSettings { mobile: boolean; desktop: boolean; } + highlightFolder: boolean; } export const DEFAULT_SETTINGS: FolderNotesSettings = { @@ -160,7 +161,8 @@ export const DEFAULT_SETTINGS: FolderNotesSettings = { openSidebar: { mobile: false, desktop: true, - } + }, + highlightFolder: true, }; export class SettingsTab extends PluginSettingTab { diff --git a/styles.css b/styles.css index 1537f73..a63dab3 100644 --- a/styles.css +++ b/styles.css @@ -15,7 +15,7 @@ } body:not(.is-grabbing) .tree-item-self.fn-is-active:hover, -.tree-item-self.fn-is-active { +body:not(.disable-folder-highlight) .tree-item-self.fn-is-active { color: var(--nav-item-color-active); background-color: var(--nav-item-background-active); font-weight: var(--nav-item-weight-active);