From 3268626bddcc19b8f82349678a829adb4b113f6a Mon Sep 17 00:00:00 2001 From: Akos Balasko Date: Thu, 24 Mar 2022 14:23:10 +0100 Subject: [PATCH] backward compatibility --- main.ts | 6 ++++-- utils/isInSpecificFolder.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main.ts b/main.ts index 2aaa9b8..592abee 100644 --- a/main.ts +++ b/main.ts @@ -329,7 +329,7 @@ class ZoottelkeeperPluginSettingTab extends PluginSettingTab { new Setting(containerEl) .setName('Folders included') .setDesc( - 'Specify the folders to be handled by Zoottelkeeper. They must be absolute paths starting from the root vault one per line. Empty list means all of the vault will be handled except the excluded folders. \n E.g. "Notes/ Articles/", \n that will include Notes and Articles folder in the root folder. * can be added to the end, to include the folder\'s subdirectories recursively, e.g. Notes/* Articles/' + 'Specify the folders to be handled by Zoottelkeeper. They must be absolute paths starting from the root vault, one per line, example: Notes/ Articles/, which will include Notes and Articles folder in the root folder. Empty list means all of the vault will be handled except the excluded folders. \'*\' can be added to the end, to include the folder\'s subdirectories recursively, e.g. Notes/* Articles/' ) .addTextArea((text) => text @@ -337,6 +337,7 @@ class ZoottelkeeperPluginSettingTab extends PluginSettingTab { .setValue(this.plugin.settings.foldersIncluded) .onChange(async (value) => { this.plugin.settings.foldersIncluded = value + .replace(/,/g,'\n') .split('\n') .map( folder=> { @@ -352,7 +353,7 @@ class ZoottelkeeperPluginSettingTab extends PluginSettingTab { new Setting(containerEl) .setName('Folders excluded') .setDesc( - 'Specify the folders NOT to be handled by Zoottelkeeper. They must be absolute paths starting from the root vault, one per line. \n e.g. "Notes/ Articles/ ", it will exclude Notes and Articles folder in the root folder. * can be added to the end, to exclude the folder\'s subdirectories recursively.' + 'Specify the folders NOT to be handled by Zoottelkeeper. They must be absolute paths starting from the root vault, one per line. Example: "Notes/ Articles/ ", it will exclude Notes and Articles folder in the root folder. * can be added to the end, to exclude the folder\'s subdirectories recursively.' ) .addTextArea((text) => text @@ -360,6 +361,7 @@ class ZoottelkeeperPluginSettingTab extends PluginSettingTab { .setValue(this.plugin.settings.foldersExcluded) .onChange(async (value) => { this.plugin.settings.foldersExcluded = value + .replace(/,/g,'\n') .split('\n') .map( folder=> { diff --git a/utils/isInSpecificFolder.ts b/utils/isInSpecificFolder.ts index d6170b7..ab7523f 100644 --- a/utils/isInSpecificFolder.ts +++ b/utils/isInSpecificFolder.ts @@ -11,7 +11,7 @@ export const isInDisAllowedFolder = (settings: ZoottelkeeperPluginSettings, inde export const isInSpecificFolder = (settings: ZoottelkeeperPluginSettings, indexFilePath: string, folderType: string): boolean => { - return !!settings[folderType].split('\n').find((folder: any) => { + return !!settings[folderType].replace(/,/g,'\n').split('\n').find((folder: any) => { return folder.endsWith('*') ? indexFilePath.startsWith(folder.slice(0, -1).trim()) : indexFilePath.split(folder).length > 1 && !indexFilePath.split(folder)[1].includes('/');