Fix remaining issues

This commit is contained in:
Lost Paul 2025-01-08 22:33:22 +01:00
parent a44cba7ef8
commit 8338368712
6 changed files with 15 additions and 15 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -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 '/';

View file

@ -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 {