Quick bugfix

This commit is contained in:
caffae 2024-08-24 02:07:49 +08:00
parent a11908a5fe
commit f20a299a4b
2 changed files with 10 additions and 2 deletions

View file

@ -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",

10
main.ts
View file

@ -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