fix: use default note type when creating folder note from click event

The click event handlers would call `createFolderNote` with an undefined `extension` parameter, which will ultimately lead to the specified Template not being applied due to a mismatch between the actually created and specified file extensions here: 945c25f97e/src/functions/folderNoteFunctions.ts (L112)

This change explicitly sets the extension parameter to whatever is specified in the settings as default, to prevent that error from happening.
This commit is contained in:
Maximilian Ertl 2024-05-09 20:55:31 +02:00 committed by Maxi Ertl
parent c1e7567a6e
commit c00f9951e6
No known key found for this signature in database

View file

@ -37,7 +37,7 @@ export async function handleViewHeaderClick(event: MouseEvent, plugin: FolderNot
return;
} else if (event.altKey || Keymap.isModEvent(event) === 'tab') {
if ((plugin.settings.altKey && event.altKey) || (plugin.settings.ctrlKey && Keymap.isModEvent(event) === 'tab')) {
await createFolderNote(plugin, folderPath, true, undefined, true);
await createFolderNote(plugin, folderPath, true, plugin.settings.folderNoteType, true);
addCSSClassToTitleEL(folderPath, 'has-folder-note', plugin);
removeCSSClassFromEL(folderPath, 'has-not-folder-note', plugin);
return;
@ -87,7 +87,7 @@ export async function handleFolderClick(event: MouseEvent, plugin: FolderNotesPl
}
} else if (event.altKey || Keymap.isModEvent(event) === 'tab') {
if ((plugin.settings.altKey && event.altKey) || (plugin.settings.ctrlKey && Keymap.isModEvent(event) === 'tab')) {
await createFolderNote(plugin, folderPath, true, undefined, true);
await createFolderNote(plugin, folderPath, true, plugin.settings.folderNoteType, true);
addCSSClassToTitleEL(folderPath, 'has-folder-note', plugin);
removeCSSClassFromEL(folderPath, 'has-not-folder-note', plugin);
return;