Fixed folder note delete button

This commit is contained in:
Lost Paul 2023-06-09 17:25:57 +02:00
parent 6291cceb9d
commit 0ef6ece62c
2 changed files with 8 additions and 3 deletions

View file

@ -90,9 +90,11 @@ export async function openFolderNote(plugin: FolderNotesPlugin, file: TAbstractF
export async function deleteFolderNote(plugin: FolderNotesPlugin, file: TFile) {
if (plugin.settings.showDeleteConfirmation) {
return new DeleteConfirmationModal(plugin.app, this, file).open();
return new DeleteConfirmationModal(plugin.app, plugin, file).open();
}
plugin.removeCSSClassFromEL(file.parent.path, 'has-folder-note');
const folder = getFolder(plugin, file);
if (!folder) return;
plugin.removeCSSClassFromEL(folder.path, 'has-folder-note');
await plugin.app.vault.delete(file);
}

View file

@ -1,5 +1,6 @@
import { App, Modal, Setting, TFile, Platform } from 'obsidian';
import FolderNotesPlugin from '../main';
import { getFolder } from 'src/folderNoteFunctions';
export default class DeleteConfirmationModal extends Modal {
plugin: FolderNotesPlugin;
app: App;
@ -28,7 +29,9 @@ export default class DeleteConfirmationModal extends Modal {
this.plugin.settings.showDeleteConfirmation = false;
this.plugin.saveSettings();
this.close();
this.plugin.removeCSSClassFromEL(this.file.parent.path, 'has-folder-note');
const folder = getFolder(this.plugin, this.file);
if (!folder) return;
this.plugin.removeCSSClassFromEL(folder?.path, 'has-folder-note');
this.app.vault.delete(this.file);
});
} else {