From 83383687126a707232d3fe01a8e3811e69a57f42 Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Wed, 8 Jan 2025 22:33:22 +0100 Subject: [PATCH] Fix remaining issues --- manifest.json | 2 +- .../modals/WhitelistedFoldersSettings.ts | 2 +- src/events/handleClick.ts | 4 ++-- src/events/handleRename.ts | 16 ++++++++-------- src/functions/utils.ts | 4 ++-- src/modals/AddSupportedFileType.ts | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/manifest.json b/manifest.json index 383591b..1632a52 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-notes", "name": "Folder notes", - "version": "1.7.33", + "version": "1.7.34", "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/ExcludeFolders/modals/WhitelistedFoldersSettings.ts b/src/ExcludeFolders/modals/WhitelistedFoldersSettings.ts index 306a2e0..eff0c38 100644 --- a/src/ExcludeFolders/modals/WhitelistedFoldersSettings.ts +++ b/src/ExcludeFolders/modals/WhitelistedFoldersSettings.ts @@ -10,7 +10,7 @@ export default class WhitelistedFoldersSettings extends Modal { app: App; settingsTab: SettingsTab; constructor(settingsTab: SettingsTab) { - super(app); + super(settingsTab.app); this.plugin = settingsTab.plugin; this.settingsTab = settingsTab; this.app = settingsTab.app; diff --git a/src/events/handleClick.ts b/src/events/handleClick.ts index bfe1978..4320fb1 100644 --- a/src/events/handleClick.ts +++ b/src/events/handleClick.ts @@ -38,7 +38,7 @@ export async function handleViewHeaderClick(event: MouseEvent, plugin: FolderNot } else if (event.altKey || Keymap.isModEvent(event) === 'tab') { if ((plugin.settings.altKey && event.altKey) || (plugin.settings.ctrlKey && Keymap.isModEvent(event) === 'tab')) { await createFolderNote(plugin, folderPath, true, undefined, true); - addCSSClassToTitleEL(plugin, folderPath, 'has-folder-note'); + addCSSClassToTitleEL(folderPath, 'has-folder-note'); removeCSSClassFromEL(folderPath, 'has-not-folder-note'); return; } @@ -86,7 +86,7 @@ export async function handleFolderClick(event: MouseEvent, plugin: FolderNotesPl } else if (event.altKey || Keymap.isModEvent(event) === 'tab') { if ((plugin.settings.altKey && event.altKey) || (plugin.settings.ctrlKey && Keymap.isModEvent(event) === 'tab')) { await createFolderNote(plugin, folderPath, true, undefined, true); - addCSSClassToTitleEL(plugin, folderPath, 'has-folder-note'); + addCSSClassToTitleEL(folderPath, 'has-folder-note'); removeCSSClassFromEL(folderPath, 'has-not-folder-note'); return; } diff --git a/src/events/handleRename.ts b/src/events/handleRename.ts index d38eede..58f5940 100644 --- a/src/events/handleRename.ts +++ b/src/events/handleRename.ts @@ -12,7 +12,7 @@ export function handleRename(file: TAbstractFile, oldPath: string, plugin: Folde const isRename = (file.parent?.path === getFolderPathFromString(oldPath)) if (folder instanceof TFolder) { if (plugin.isEmptyFolderNoteFolder(folder)) { - addCSSClassToTitleEL(plugin, folder.path, 'only-has-folder-note'); + addCSSClassToTitleEL(folder.path, 'only-has-folder-note'); } else { removeCSSClassFromEL(folder.path, 'only-has-folder-note'); } @@ -20,7 +20,7 @@ export function handleRename(file: TAbstractFile, oldPath: string, plugin: Folde if (oldFolder instanceof TFolder) { if (plugin.isEmptyFolderNoteFolder(oldFolder)) { - addCSSClassToTitleEL(plugin, oldFolder.path, 'only-has-folder-note'); + addCSSClassToTitleEL(oldFolder.path, 'only-has-folder-note'); } else { removeCSSClassFromEL(oldFolder.path, 'only-has-folder-note'); } @@ -143,8 +143,8 @@ export async function handleFileRename(file: TFile, oldPath: string, plugin: Fol const folderNote = getFolderNote(plugin, oldPath, plugin.settings.storageLocation, file); if (!excludedFolder?.disableFolderNote && folderName === newFolder?.name && !detachedExcludedFolder) { - addCSSClassToTitleEL(plugin, file.path, 'is-folder-note'); - addCSSClassToTitleEL(plugin, newFolder.path, 'has-folder-note'); + addCSSClassToTitleEL(file.path, 'is-folder-note'); + addCSSClassToTitleEL(newFolder.path, 'has-folder-note'); return; } else if (excludedFolder?.disableFolderNote || (folderName !== newFolder?.name)) { removeCSSClassFromEL(file.path, 'is-folder-note'); @@ -155,9 +155,9 @@ export async function handleFileRename(file: TFile, oldPath: string, plugin: Fol if (folderName === newFolder?.name) { - addCSSClassToTitleEL(plugin, file.path, 'is-folder-note'); + addCSSClassToTitleEL(file.path, 'is-folder-note'); removeCSSClassFromEL(oldFolder?.path, 'has-folder-note'); - addCSSClassToTitleEL(plugin, newFolder.path, 'has-folder-note'); + addCSSClassToTitleEL(newFolder.path, 'has-folder-note'); return; } @@ -179,8 +179,8 @@ async function renameFolderOnFileRename(file: TFile, oldPath: string, oldFolder: removeCSSClassFromEL(file.path, 'is-folder-note'); return; } else if (newFolderName === oldFolder.name) { - addCSSClassToTitleEL(plugin, oldFolder.path, 'has-folder-note'); - addCSSClassToTitleEL(plugin, file.path, 'is-folder-note'); + addCSSClassToTitleEL(oldFolder.path, 'has-folder-note'); + addCSSClassToTitleEL(file.path, 'is-folder-note'); return; } diff --git a/src/functions/utils.ts b/src/functions/utils.ts index 2ea5210..b6086ec 100644 --- a/src/functions/utils.ts +++ b/src/functions/utils.ts @@ -1,7 +1,7 @@ import { FileExplorerWorkspaceLeaf } from "src/globals"; export function getFileNameFromPathString(path: string): string { - return path.substring(path.lastIndexOf('/' || '\\') >= 0 ? path.lastIndexOf('/' || '\\') + 1 : 0); + return path.substring(path.lastIndexOf('/') >= 0 ? path.lastIndexOf('/') + 1 : 0); } export function getFolderNameFromPathString(path: string): string { @@ -21,7 +21,7 @@ export function getExtensionFromPathString(path: string): string { } export function getFolderPathFromString(path: string): string { - const subString = path.lastIndexOf('/' || '\\') >= 0 ? path.lastIndexOf('/') : 0; + const subString = path.lastIndexOf('/') >= 0 ? path.lastIndexOf('/') : 0; const folderPath = path.substring(0, subString); if (folderPath === '') { return '/'; diff --git a/src/modals/AddSupportedFileType.ts b/src/modals/AddSupportedFileType.ts index dca5570..990b451 100644 --- a/src/modals/AddSupportedFileType.ts +++ b/src/modals/AddSupportedFileType.ts @@ -1,6 +1,6 @@ import { App, Modal, Setting, TFolder, Notice } from 'obsidian'; import FolderNotesPlugin from '../main'; -import ListComponent from 'src/functions/ListComponent'; +import { ListComponent } from 'src/functions/ListComponent'; import { SettingTab } from 'obsidian'; export default class AddSupportedFileModal extends Modal {