From f20a299a4ba73b5b1fa373e974792dbabac87b51 Mon Sep 17 00:00:00 2001 From: caffae Date: Sat, 24 Aug 2024 02:07:49 +0800 Subject: [PATCH] Quick bugfix --- current-folder-notes/manifest.json | 2 +- main.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/current-folder-notes/manifest.json b/current-folder-notes/manifest.json index 2f2f20b..b7f5c74 100644 --- a/current-folder-notes/manifest.json +++ b/current-folder-notes/manifest.json @@ -1,7 +1,7 @@ { "id": "current-folder-notes-pamphlet", "name": "Current Folder Notes", - "version": "1.6.0", + "version": "1.6.1", "minAppVersion": "1.5.11", "description": "Shows a list of notes in the current folder, and allows you to filter the titles to include or exclude notes.", "author": "Pamela Wang", diff --git a/main.ts b/main.ts index 241eb54..b99d577 100644 --- a/main.ts +++ b/main.ts @@ -276,13 +276,21 @@ export class CurrentFolderNotesDisplayView extends ItemView { includeWords.forEach((word, index) => { includeWords[index] = word.trim(); }); + + // if there are words use to filter files + if (includeWords.length > 0) { + possibleFilteredFiles = parentFolderFiles.filter(file => includeWords.some(word => file.basename.toLowerCase().includes(word.toLowerCase()))); + } else { + possibleFilteredFiles = parentFolderFiles; + } + /* The line `console.log(includeWords);` is logging the array `includeWords` to the console. This is helpful for debugging and understanding the content of the array at that point in the code execution. It allows you to see the individual words extracted from the `includesFilter` string and trimmed of any extra spaces. */ // console.log(includeWords); // filter out notes that do not include any of the words in the filter and do it in a case insensitive way - possibleFilteredFiles = parentFolderFiles.filter(file => includeWords.some(word => file.basename.toLowerCase().includes(word.toLowerCase()))); + // const possibleFilteredFiles = parentFolderFiles.filter(file => file.basename.includes(includesFilter));; } else { // filter out notes that do not include the words in the filter and do it in a case insensitive way