Add id to Exclude Pattern/Folder

To make it easier to delete a pattern/folder and have multiple of them with the same path or string
This commit is contained in:
Lost Paul 2024-05-21 17:31:33 +02:00
parent f48598d55f
commit 0978c220af
3 changed files with 8 additions and 4 deletions

View file

@ -1,6 +1,7 @@
import FolderNotesPlugin from '../main';
export class ExcludedFolder {
type: string;
id: string;
path: string;
string: string;
subFolders: boolean;
@ -11,8 +12,9 @@ export class ExcludedFolder {
position: number;
excludeFromFolderOverview: boolean;
hideInSettings: boolean;
constructor(path: string, position: number, plugin: FolderNotesPlugin) {
constructor(path: string, position: number, id: string | undefined, plugin: FolderNotesPlugin) {
this.type = 'folder';
this.id = id || crypto.randomUUID();
this.path = path;
this.subFolders = plugin.settings.excludeFolderDefaultSettings.subFolders;
this.disableSync = plugin.settings.excludeFolderDefaultSettings.disableSync;

View file

@ -1,6 +1,7 @@
import FolderNotesPlugin from '../main';
export class ExcludePattern {
type: string;
id: string;
string: string;
path: string;
position: number;
@ -11,8 +12,9 @@ export class ExcludePattern {
enableCollapsing: boolean;
excludeFromFolderOverview: boolean;
hideInSettings: boolean;
constructor(pattern: string, position: number, plugin: FolderNotesPlugin) {
constructor(pattern: string, position: number, id: string | undefined, plugin: FolderNotesPlugin) {
this.type = 'pattern';
this.id = id || crypto.randomUUID();
this.string = pattern;
this.position = position;
this.subFolders = plugin.settings.excludePatternDefaultSettings.subFolders;

View file

@ -19,6 +19,7 @@ export default class PatternSettings extends Modal {
const { contentEl } = this;
contentEl.empty();
contentEl.createEl('h2', { text: 'Pattern settings' });
new Setting(contentEl)
.setName('Disable folder name sync')
.setDesc('Choose if the folder name should be renamed when the file name has been changed')
@ -55,7 +56,6 @@ export default class PatternSettings extends Modal {
})
);
new Setting(contentEl)
.setName('Disable open folder note')
.setDesc('Choose if the folder note should be opened when the folder is opened')
@ -64,7 +64,7 @@ export default class PatternSettings extends Modal {
.setValue(this.pattern.disableFolderNote)
.onChange(async (value) => {
this.pattern.disableFolderNote = value;
await this.plugin.saveSettings();
await this.plugin.saveSettings(true);
this.display();
})
);