From 4d6820dc53eedc95cc8e9d87f4c5d8a09f6b628e Mon Sep 17 00:00:00 2001 From: Lost Paul <70213368+LostPaul@users.noreply.github.com> Date: Thu, 26 Jun 2025 20:26:25 +0200 Subject: [PATCH] Fix choose folder note type modal --- src/functions/folderNoteFunctions.ts | 1 + src/main.ts | 1 + src/modals/AskForExtension.ts | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/functions/folderNoteFunctions.ts b/src/functions/folderNoteFunctions.ts index 24b68c1..7eb78d7 100644 --- a/src/functions/folderNoteFunctions.ts +++ b/src/functions/folderNoteFunctions.ts @@ -42,6 +42,7 @@ export async function createFolderNote(plugin: FolderNotesPlugin, folderPath: st folderNoteType = '.md'; extension = '.excalidraw'; } else if (folderNoteType === '.ask') { + if (plugin.askModalCurrentlyOpen) return; return new AskForExtensionModal(plugin, folderPath, openFile, folderNoteType, displayModal, preexistingNote).open(); } diff --git a/src/main.ts b/src/main.ts index 74e938c..f19c5aa 100644 --- a/src/main.ts +++ b/src/main.ts @@ -33,6 +33,7 @@ export default class FolderNotesPlugin extends Plugin { hoverLinkTriggered = false; tabManager: TabManager; settingsOpened = false; + askModalCurrentlyOpen = false; private fileExplorerPlugin!: InternalPlugin; private fileExplorerView!: FileExplorerView; diff --git a/src/modals/AskForExtension.ts b/src/modals/AskForExtension.ts index 7ae80d3..27811c9 100644 --- a/src/modals/AskForExtension.ts +++ b/src/modals/AskForExtension.ts @@ -16,6 +16,7 @@ export class AskForExtensionModal extends FuzzySuggestModal { this.openFile = openFile; this.useModal = useModal; this.existingNote = existingNote; + plugin.askModalCurrentlyOpen = true; } getItems(): string[] { @@ -27,6 +28,7 @@ export class AskForExtensionModal extends FuzzySuggestModal { } onChooseItem(item: string, evt: MouseEvent | KeyboardEvent) { + this.plugin.askModalCurrentlyOpen = false; this.extension = '.' + item; createFolderNote(this.plugin, this.folderPath, this.openFile, this.extension, this.useModal, this.existingNote); this.close();