mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
90 lines
No EOL
3.4 KiB
TypeScript
90 lines
No EOL
3.4 KiB
TypeScript
import { App, Modal, Setting } from 'obsidian';
|
|
import FolderNotesPlugin from '../main';
|
|
import { ExcludedFolder } from '../settings';
|
|
export default class ExcludedFolderSettings extends Modal {
|
|
plugin: FolderNotesPlugin;
|
|
app: App;
|
|
excludedFolder: ExcludedFolder;
|
|
constructor(app: App, plugin: FolderNotesPlugin, excludedFolder: ExcludedFolder) {
|
|
super(app);
|
|
this.plugin = plugin;
|
|
this.app = app;
|
|
this.excludedFolder = excludedFolder;
|
|
}
|
|
onOpen() {
|
|
this.display();
|
|
}
|
|
display() {
|
|
const { contentEl } = this;
|
|
contentEl.empty();
|
|
contentEl.createEl('h2', { text: 'Exluded folder settings' });
|
|
new Setting(contentEl)
|
|
.setName('Include subfolders')
|
|
.setDesc('Choose if the subfolders of the folder should also be excluded')
|
|
.addToggle((toggle) =>
|
|
toggle
|
|
.setValue(this.excludedFolder.subFolders)
|
|
.onChange(async (value) => {
|
|
this.excludedFolder.subFolders = value;
|
|
await this.plugin.saveSettings();
|
|
})
|
|
);
|
|
|
|
new Setting(contentEl)
|
|
.setName('Disable folder name sync')
|
|
.setDesc('Choose if the folder note should be renamed when the folder name is changed')
|
|
.addToggle((toggle) =>
|
|
toggle
|
|
.setValue(this.excludedFolder.disableSync)
|
|
.onChange(async (value) => {
|
|
this.excludedFolder.disableSync = value;
|
|
await this.plugin.saveSettings();
|
|
})
|
|
);
|
|
|
|
new Setting(contentEl)
|
|
.setName('Disable auto creation of folder notes in this folder')
|
|
.setDesc('Choose if a folder note should be created when a new folder is created')
|
|
.addToggle((toggle) =>
|
|
toggle
|
|
.setValue(this.excludedFolder.disableAutoCreate)
|
|
.onChange(async (value) => {
|
|
this.excludedFolder.disableAutoCreate = value;
|
|
await this.plugin.saveSettings();
|
|
})
|
|
);
|
|
|
|
|
|
new Setting(contentEl)
|
|
.setName('Disable open folder note')
|
|
.setDesc('Choose if the folder note should be opened when the folder is opened')
|
|
.addToggle((toggle) =>
|
|
toggle
|
|
.setValue(this.excludedFolder.disableFolderNote)
|
|
.onChange(async (value) => {
|
|
this.excludedFolder.disableFolderNote = value;
|
|
await this.plugin.saveSettings();
|
|
this.display();
|
|
})
|
|
);
|
|
|
|
if (!this.excludedFolder.disableFolderNote) {
|
|
new Setting(contentEl)
|
|
.setName('Collapse folder when opening folder note')
|
|
.setDesc('Choose if the folder should be collapsed when the folder note is opened')
|
|
.addToggle((toggle) =>
|
|
toggle
|
|
.setValue(this.excludedFolder.enableCollapsing)
|
|
.onChange(async (value) => {
|
|
this.excludedFolder.enableCollapsing = value;
|
|
await this.plugin.saveSettings();
|
|
})
|
|
);
|
|
}
|
|
|
|
}
|
|
onClose() {
|
|
const { contentEl } = this;
|
|
contentEl.empty();
|
|
}
|
|
} |