diff --git a/manifest.json b/manifest.json index 9958194..493414e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-notes", "name": "Folder notes", - "version": "1.6.2", + "version": "1.6.3", "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/FileExplorerSettings.ts b/src/settings/FileExplorerSettings.ts index d97fd00..f000423 100644 --- a/src/settings/FileExplorerSettings.ts +++ b/src/settings/FileExplorerSettings.ts @@ -3,22 +3,6 @@ import { SettingsTab } from "./SettingsTab"; export async function renderFileExplorer(settingsTab: SettingsTab) { const containerEl = settingsTab.settingsPage; settingsTab.settingsPage.createEl('h1', { text: 'File explorer settings' }); - new Setting(containerEl) - .setName('Add underline to folders with folder notes') - .setDesc('Add an underline to folders that have a folder note in the file explorer') - .addToggle((toggle) => - toggle - .setValue(settingsTab.plugin.settings.underlineFolder) - .onChange(async (value) => { - settingsTab.plugin.settings.underlineFolder = value; - if (value) { - document.body.classList.add('folder-note-underline'); - } else { - document.body.classList.remove('folder-note-underline'); - } - await settingsTab.plugin.saveSettings(); - }) - ); new Setting(containerEl) .setName('Hide folder note') @@ -97,4 +81,58 @@ export async function renderFileExplorer(settingsTab: SettingsTab) { }) ); } -} \ No newline at end of file + + settingsTab.settingsPage.createEl('h3', { text: 'Style settings' }); + + 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') + .addToggle((toggle) => + toggle + .setValue(settingsTab.plugin.settings.underlineFolder) + .onChange(async (value) => { + settingsTab.plugin.settings.underlineFolder = value; + if (value) { + document.body.classList.add('folder-note-underline'); + } else { + document.body.classList.remove('folder-note-underline'); + } + await settingsTab.plugin.saveSettings(); + }) + ); + + new Setting(containerEl) + .setName('Bold the name of folder notes') + .setDesc('Make the folder name bold in the file explorer') + .addToggle((toggle) => + toggle + .setValue(settingsTab.plugin.settings.boldName) + .onChange(async (value) => { + settingsTab.plugin.settings.boldName = value; + if (value) { + document.body.classList.add('folder-note-bold'); + } else { + document.body.classList.remove('folder-note-bold'); + } + await settingsTab.plugin.saveSettings(); + }) + ); + + new Setting(containerEl) + .setName('Cursive the name of folder notes') + .setDesc('Make the folder name cursive in the file explorer') + .addToggle((toggle) => + toggle + .setValue(settingsTab.plugin.settings.cursiveName) + .onChange(async (value) => { + settingsTab.plugin.settings.cursiveName = value; + if (value) { + document.body.classList.add('folder-note-cursive'); + } else { + document.body.classList.remove('folder-note-cursive'); + } + await settingsTab.plugin.saveSettings(); + }) + ); + +} diff --git a/src/settings/PathSettings.ts b/src/settings/PathSettings.ts index 4baaeba..3151503 100644 --- a/src/settings/PathSettings.ts +++ b/src/settings/PathSettings.ts @@ -16,6 +16,25 @@ export async function renderPath(settingsTab: SettingsTab) { }) ); + new Setting(containerEl) + .setName('Change folder name in the path') + .setDesc('Automatically rename a folder name in the path above a note when the folder note is renamed') + .addToggle((toggle) => + toggle + .setValue(settingsTab.plugin.settings.frontMatterTitle.path) + .onChange(async (value) => { + settingsTab.plugin.settings.frontMatterTitle.path = value; + await settingsTab.plugin.saveSettings(); + if (value) { + settingsTab.plugin.updateBreadcrumbs(); + } else { + settingsTab.plugin.updateBreadcrumbs(true); + } + }) + ); + + settingsTab.settingsPage.createEl('h3', { text: 'Style settings' }); + if (settingsTab.plugin.settings.openFolderNoteOnClickInPath) { new Setting(containerEl) .setName('Underline folders in the path') @@ -36,19 +55,37 @@ export async function renderPath(settingsTab: SettingsTab) { } new Setting(containerEl) - .setName('Change folder name in the path') - .setDesc('Automatically rename a folder name in the path above a note when the folder note is renamed') + .setName('Bold folders in the path') + .setDesc('Make the folder name bold in the path above a note') .addToggle((toggle) => toggle - .setValue(settingsTab.plugin.settings.frontMatterTitle.path) + .setValue(settingsTab.plugin.settings.boldNameInPath) .onChange(async (value) => { - settingsTab.plugin.settings.frontMatterTitle.path = value; - await settingsTab.plugin.saveSettings(); + settingsTab.plugin.settings.boldNameInPath = value; if (value) { - settingsTab.plugin.updateBreadcrumbs(); + document.body.classList.add('folder-note-bold-path'); } else { - settingsTab.plugin.updateBreadcrumbs(true); + document.body.classList.remove('folder-note-bold-path'); } + await settingsTab.plugin.saveSettings(); }) ); + + new Setting(containerEl) + .setName('Cursive the name of folder notes in the path') + .setDesc('Make the folder name cursive in the path above a note') + .addToggle((toggle) => + toggle + .setValue(settingsTab.plugin.settings.cursiveNameInPath) + .onChange(async (value) => { + settingsTab.plugin.settings.cursiveNameInPath = value; + if (value) { + document.body.classList.add('folder-note-cursive-path'); + } else { + document.body.classList.remove('folder-note-cursive-path'); + } + await settingsTab.plugin.saveSettings(); + }) + ); + } \ No newline at end of file diff --git a/src/settings/SettingsTab.ts b/src/settings/SettingsTab.ts index 286afe8..4510bc0 100644 --- a/src/settings/SettingsTab.ts +++ b/src/settings/SettingsTab.ts @@ -41,6 +41,10 @@ export interface FolderNotesSettings { }, settingsTab: string; supportedFileTypes: string[]; + boldName: boolean; + boldNameInPath: boolean; + cursiveName: boolean; + cursiveNameInPath: boolean; } export const DEFAULT_SETTINGS: FolderNotesSettings = { @@ -89,7 +93,11 @@ export const DEFAULT_SETTINGS: FolderNotesSettings = { path: true, }, settingsTab: 'general', - supportedFileTypes: ['md', 'canvas'] + supportedFileTypes: ['md', 'canvas'], + boldName: false, + boldNameInPath: false, + cursiveName: false, + cursiveNameInPath: false, }; export class SettingsTab extends PluginSettingTab { diff --git a/styles.css b/styles.css index eb1212b..b334696 100644 --- a/styles.css +++ b/styles.css @@ -20,21 +20,6 @@ cursor: pointer; } -.folder-note-underline .has-folder-note .nav-folder-title-content { - text-decoration-line: underline; - text-decoration-color: var(--text-faint); - text-decoration-thickness: 2px; - text-underline-offset: 1px; -} - -.folder-note-underline-path .has-folder-note.view-header-breadcrumb { - text-decoration-line: underline; - text-decoration-color: var(--text-faint); - text-decoration-thickness: 1px; - text-underline-offset: 2px; -} - - .hide-folder-note .is-folder-note { display: none; @@ -205,4 +190,36 @@ .fn-settings-tab-icon { display: flex; +} + +/* File explorer & path styles */ + +.folder-note-underline .has-folder-note .nav-folder-title-content { + text-decoration-line: underline; + text-decoration-color: var(--text-faint); + text-decoration-thickness: 2px; + text-underline-offset: 1px; +} + +.folder-note-underline-path .has-folder-note.view-header-breadcrumb { + text-decoration-line: underline; + text-decoration-color: var(--text-faint); + text-decoration-thickness: 1px; + text-underline-offset: 2px; +} + +.folder-note-bold .has-folder-note .nav-folder-title-content { + font-weight: bold; +} + +.folder-note-bold-path .has-folder-note.view-header-breadcrumb { + font-weight: bold; +} + +.folder-note-cursive .has-folder-note .nav-folder-title-content { + font-style: italic; +} + +.folder-note-cursive-path .has-folder-note.view-header-breadcrumb { + font-style: italic; } \ No newline at end of file