mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Check if note is already a folder note
This commit is contained in:
parent
d27712b4b4
commit
c59f59b793
1 changed files with 3 additions and 3 deletions
|
|
@ -64,6 +64,9 @@ export class Commands {
|
|||
}));
|
||||
this.plugin.registerEvent(this.app.workspace.on('file-menu', (menu: Menu, file: TAbstractFile) => {
|
||||
if (file instanceof TFile) {
|
||||
const folder = file.parent;
|
||||
const folderNote = getFolderNote(this.plugin, folder.path);
|
||||
if (folderNote?.path === file.path) { return; }
|
||||
menu.addItem((item) => {
|
||||
item.setTitle('Create folder note')
|
||||
.setIcon('edit')
|
||||
|
|
@ -82,10 +85,7 @@ export class Commands {
|
|||
});
|
||||
});
|
||||
if (this.plugin.getFolderPathFromString(file.path) === '') return;
|
||||
const folder = file.parent;
|
||||
if (!(folder instanceof TFolder)) return;
|
||||
const folderNote = getFolderNote(this.plugin, folder.path);
|
||||
if (folderNote?.path === file.path) { return; }
|
||||
menu.addItem((item) => {
|
||||
item.setTitle('Turn into folder note')
|
||||
.setIcon('edit')
|
||||
|
|
|
|||
Loading…
Reference in a new issue