Fix choose folder note type modal

This commit is contained in:
Lost Paul 2025-06-26 20:26:25 +02:00
parent d050217f5b
commit 4d6820dc53
3 changed files with 4 additions and 0 deletions

View file

@ -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();
}

View file

@ -33,6 +33,7 @@ export default class FolderNotesPlugin extends Plugin {
hoverLinkTriggered = false;
tabManager: TabManager;
settingsOpened = false;
askModalCurrentlyOpen = false;
private fileExplorerPlugin!: InternalPlugin;
private fileExplorerView!: FileExplorerView;

View file

@ -16,6 +16,7 @@ export class AskForExtensionModal extends FuzzySuggestModal<string> {
this.openFile = openFile;
this.useModal = useModal;
this.existingNote = existingNote;
plugin.askModalCurrentlyOpen = true;
}
getItems(): string[] {
@ -27,6 +28,7 @@ export class AskForExtensionModal extends FuzzySuggestModal<string> {
}
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();