From 6d100212b7a5749216d606fe88f4d1e39518df25 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 20 Mar 2022 13:57:02 +0100 Subject: [PATCH] save settings that are edited --- main.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/main.ts b/main.ts index a7779e3..7d51803 100644 --- a/main.ts +++ b/main.ts @@ -164,11 +164,11 @@ class KeepView extends ItemView { class KeepSettingTab extends PluginSettingTab { - settings: KeepSettings; + plugin: KeepPlugin; constructor(app: App, plugin: KeepPlugin) { super(app, plugin); - this.settings = plugin.settings; + this.plugin = plugin; } display(): void { @@ -178,10 +178,11 @@ class KeepSettingTab extends PluginSettingTab { new Setting(this.containerEl) .setName('Padding') .setDesc('The padding that should be left around the inside of the Google Keep view, in pixels.') - .addText(t => { + .addText(async t => { t.inputEl.type = "number"; - t.setValue(String(this.settings.padding)); - t.onChange(async v => this.settings.padding = Number(v)); + t.setValue(String(this.plugin.settings.padding)); + t.onChange(async v => this.plugin.settings.padding = Number(v)); + await this.plugin.saveSettings(); }); new Setting(this.containerEl) @@ -190,8 +191,11 @@ class KeepSettingTab extends PluginSettingTab { .addTextArea(t => { t.inputEl.rows = 10; t.inputEl.cols = 50; - t.setValue(this.settings.css); - t.onChange(async v => this.settings.css = v); + t.setValue(this.plugin.settings.css); + t.onChange(async v => { + this.plugin.settings.css = v; + await this.plugin.saveSettings(); + }); }); } } \ No newline at end of file