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('/');