feat: Add onChange event to save comments settings

This commit is contained in:
barkstone 2024-12-09 21:24:40 +09:00 committed by barkstone2
parent 1403db9e4b
commit 7b6ab09075

View file

@ -141,8 +141,9 @@ export class VTBSettingTab extends PluginSettingTab {
.setName('Enable Utterances comments layout')
.addToggle((cb) => {
cb.setValue(this.settings.isEnableComments);
cb.onChange((value) => {
cb.onChange(async (value) => {
this.settings.isEnableComments = value;
await this.plugin.saveSettings();
this.display()
})
})
@ -152,6 +153,10 @@ export class VTBSettingTab extends PluginSettingTab {
.setName('Repo')
.addText((cb) => {
cb.setPlaceholder('owner/repo')
cb.onChange(async (value) => {
this.settings.repo = value;
await this.plugin.saveSettings();
})
})
new Setting(containerEl)
@ -168,6 +173,10 @@ export class VTBSettingTab extends PluginSettingTab {
'boxy-light': 'Boxy Light',
'gruvbox-dark': 'Gruvbox Dark',
});
cb.onChange(async (value) => {
this.settings.theme = value;
await this.plugin.saveSettings();
})
})
}
}