mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
Fix bug with auto create of folder notes and multiple folder note types
This commit is contained in:
parent
d41710ac50
commit
46ec0b14e2
2 changed files with 7 additions and 2 deletions
|
|
@ -220,10 +220,15 @@ export class Commands {
|
|||
if (this.plugin.app.vault.getAbstractFileByPath(newPath)) {
|
||||
return new Notice('Folder already exists');
|
||||
}
|
||||
const automaticallyCreateFolderNote = this.plugin.settings.autoCreate;
|
||||
this.plugin.settings.autoCreate = false;
|
||||
this.plugin.saveSettings();
|
||||
await this.plugin.app.vault.createFolder(newPath);
|
||||
const newFolder = this.plugin.app.vault.getAbstractFileByPath(newPath);
|
||||
if (!(newFolder instanceof TFolder)) return;
|
||||
createFolderNote(this.plugin, newFolder.path, true, undefined, false, file);
|
||||
await createFolderNote(this.plugin, newFolder.path, true, '.' + file.extension, false, file);
|
||||
this.plugin.settings.autoCreate = automaticallyCreateFolderNote;
|
||||
this.plugin.saveSettings();
|
||||
});
|
||||
});
|
||||
if (this.plugin.getFolderPathFromString(file.path) === '') return;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ export async function createFolderNote(plugin: FolderNotesPlugin, folderPath: st
|
|||
const leaf = plugin.app.workspace.getLeaf(false);
|
||||
const folderName = plugin.getFolderNameFromPathString(folderPath);
|
||||
const fileName = plugin.settings.folderNoteName.replace('{{folder_name}}', folderName);
|
||||
let folderNoteType = extension || plugin.settings.folderNoteType;
|
||||
let folderNoteType = extension ?? plugin.settings.folderNoteType;
|
||||
if (folderNoteType === '.excalidraw') {
|
||||
folderNoteType = '.md';
|
||||
extension = '.excalidraw';
|
||||
|
|
|
|||
Loading…
Reference in a new issue