From 08ece2293c2943bd8e0ee0fb7cbd15eeea14e720 Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Mon, 27 Mar 2023 13:15:11 +0200 Subject: [PATCH] Option to disable whitespace collapsing --- manifest.json | 2 +- src/settings.ts | 24 +++++++++++++++++++++--- styles.css | 5 +++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index f92cccf..9f42bbe 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-notes", "name": "Folder notes", - "version": "1.0.10", + "version": "1.0.11", "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/settings.ts b/src/settings.ts index 8a5548c..c9e4f58 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -15,6 +15,7 @@ export interface FolderNotesSettings { excludeFolders: ExcludedFolder[]; showDeleteConfirmation: boolean; underlineFolder: boolean; + allowWhitespaceCollapsing: boolean; } export const DEFAULT_SETTINGS: FolderNotesSettings = { @@ -27,7 +28,8 @@ export const DEFAULT_SETTINGS: FolderNotesSettings = { enableCollapsing: false, excludeFolders: [], showDeleteConfirmation: true, - underlineFolder: true + underlineFolder: true, + allowWhitespaceCollapsing: false, }; export class SettingsTab extends PluginSettingTab { plugin: FolderNotesPlugin; @@ -55,6 +57,23 @@ export class SettingsTab extends PluginSettingTab { }) ); + new Setting(containerEl) + .setName('Don\'t collapse folder when clicking on the whitespace around the folder name') + .setDesc('Disable the ability to collapse folders by clicking on the whitespace around the folder name.') + .addToggle((toggle) => + toggle + .setValue(!this.plugin.settings.allowWhitespaceCollapsing) + .onChange(async (value) => { + if (value) { + document.body.classList.add('fn-whitespace-collapsing'); + } else { + document.body.classList.remove('fn-whitespace-collapsing'); + } + this.plugin.settings.allowWhitespaceCollapsing = !value; + await this.plugin.saveSettings(); + }) + ); + new Setting(containerEl) .setName('Hide folder note') .setDesc('Hide the folder note in the file explorer') @@ -153,12 +172,11 @@ export class SettingsTab extends PluginSettingTab { // If you want to try it yourself make a pr // The issue was that it only used the first folder for all of the other folder notes /* - new Setting(containerEl) + new Setting(containerEl) .setName('Create folder note for every folder') .setDesc('Create a folder note for every folder in the vault') .addButton((cb) => { cb.setIcon('plus'); - cb.setTooltip('Create folder notes'); cb.onClick(async () => { new ConfirmationModal(this.app, this.plugin).open(); diff --git a/styles.css b/styles.css index 1728ae3..e2cb8c6 100644 --- a/styles.css +++ b/styles.css @@ -1,4 +1,4 @@ -.nav-folder-title-content.has-folder-note { +.fn-whitespace-collapsing .nav-folder-title-content.has-folder-note { flex-grow: 1; padding-bottom: 4px; padding-top: 4px; @@ -11,7 +11,7 @@ text-underline-offset: 1px; } -.nav-folder-title:has(.has-folder-note) { +.fn-whitespace-collapsing .nav-folder-title:has(.has-folder-note) { padding-bottom: 0; padding-top: 0; } @@ -80,6 +80,7 @@ flex-direction: column; align-items: center; } + .is-phone .fn-delete-confirmation-modal-buttons .fn-confirmation-modal-button { margin-top: 10px; } \ No newline at end of file