From 40d3a34e2baac0e9c20ab562dc11039302f7ce1f Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Thu, 2 Nov 2023 17:56:57 +0100 Subject: [PATCH] Fix #56 --- manifest.json | 2 +- src/Commands.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index 2b1aacd..e3179f8 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-notes", "name": "Folder notes", - "version": "1.6.5", + "version": "1.6.6", "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", diff --git a/src/Commands.ts b/src/Commands.ts index 1dc2915..67ed7e5 100644 --- a/src/Commands.ts +++ b/src/Commands.ts @@ -40,10 +40,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 folder = this.plugin.app.vault.getAbstractFileByPath(newPath); if (!(folder instanceof TFolder)) return; - createFolderNote(this.plugin, folder.path, true, file.extension, false, file); + createFolderNote(this.plugin, folder.path, true, '.' + file.extension, false, file); + this.plugin.settings.autoCreate = automaticallyCreateFolderNote; + this.plugin.saveSettings(); } }) this.plugin.addCommand({ @@ -119,7 +124,7 @@ export class Commands { const file = view.file; if (!(file instanceof TFile)) return false; if (text && text.trim() !== '') { - if (checking) { return true;} + if (checking) { return true; } const blacklist = ['*', '\\', '"', '/', '<', '>', '?', '|', ':']; for (const char of blacklist) { if (text.includes(char)) {