Fix templater vars

This commit is contained in:
Lost Paul 2025-03-04 22:00:49 +01:00
parent 805fc8ac77
commit fedddcaa84
2 changed files with 7 additions and 5 deletions

View file

@ -82,9 +82,13 @@ export async function createFolderNote(plugin: FolderNotesPlugin, folderPath: st
});
}
if (!extension) {
extension = folderNoteType;
}
if (!folderNote) {
let content = '';
if (extension !== '.md') {
if (extension !== '.md' && extension) {
if (plugin.settings.templatePath && folderNoteType.split('.').pop() === plugin.settings.templatePath.split('.').pop()) {
const templateFile = plugin.app.vault.getAbstractFileByPath(plugin.settings.templatePath);
if (templateFile instanceof TFile) {

View file

@ -31,8 +31,6 @@ export class TemplateSuggest extends AbstractInputSuggest<TFile> {
const lower_input_str = input_str.toLowerCase();
if ((!templateFolder || templateFolder.trim() === '') && !templaterPlugin) {
console.log('Template folder not found');
console.log(lower_input_str);
files = this.plugin.app.vault.getFiles().filter((file) =>
file.path.toLowerCase().includes(lower_input_str)
);
@ -61,9 +59,9 @@ export class TemplateSuggest extends AbstractInputSuggest<TFile> {
const { templateFolder, templaterPlugin } = getTemplatePlugins(this.app);
if ((!templateFolder || templateFolder.trim() === '') && !templaterPlugin) {
el.setText(`${file.parent?.path}/${file.name.replace('.md', '')}`);
el.setText(`${file.parent?.path !== '/' ? file.parent?.path + '/' : ''}${file.name}`);
} else {
el.setText(file.name.replace('.md', ''));
el.setText(file.name);
}
}