Skip to content

Commit

Permalink
backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
akosbalasko committed Mar 24, 2022
1 parent bb47b4d commit 3268626
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,15 @@ 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/ <enter> 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/* <enter> Articles/'
'Specify the folders to be handled by Zoottelkeeper. They must be absolute paths starting from the root vault, one per line, example: Notes/ <enter> 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/* <enter> Articles/'
)
.addTextArea((text) =>
text
.setPlaceholder('')
.setValue(this.plugin.settings.foldersIncluded)
.onChange(async (value) => {
this.plugin.settings.foldersIncluded = value
.replace(/,/g,'\n')
.split('\n')
.map(
folder=> {
Expand All @@ -352,14 +353,15 @@ 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/ <enter> 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/ <enter> 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
.setPlaceholder('')
.setValue(this.plugin.settings.foldersExcluded)
.onChange(async (value) => {
this.plugin.settings.foldersExcluded = value
.replace(/,/g,'\n')
.split('\n')
.map(
folder=> {
Expand Down
2 changes: 1 addition & 1 deletion utils/isInSpecificFolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('/');
Expand Down

0 comments on commit 3268626

Please sign in to comment.