Option to disable whitespace collapsing

This commit is contained in:
Lost Paul 2023-03-27 13:15:11 +02:00
parent da7935a1d9
commit 08ece2293c
3 changed files with 25 additions and 6 deletions

View file

@ -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",

View file

@ -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();

View file

@ -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;
}