mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Fixed folder note delete button
This commit is contained in:
parent
6291cceb9d
commit
0ef6ece62c
2 changed files with 8 additions and 3 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue