Skip to content

Commit

Permalink
fix: add a reset template button to reset the template to default tem…
Browse files Browse the repository at this point in the history
…plate
  • Loading branch information
sywhb committed May 22, 2023
1 parent 0f269a1 commit 06df987
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ class OmnivoreSettingTab extends PluginSettingTab {
.setPlaceholder("Enter the template")
.setValue(this.plugin.settings.template)
.onChange(async (value) => {
// TODO: validate template
// if template is empty, use default template
this.plugin.settings.template = value
? value
Expand All @@ -530,6 +529,17 @@ class OmnivoreSettingTab extends PluginSettingTab {
});
text.inputEl.setAttr("rows", 30);
text.inputEl.setAttr("cols", 60);
}).addExtraButton((button) => {
// add a button to reset template
button
.setIcon("reset")
.setTooltip("Reset template")
.onClick(async () => {
this.plugin.settings.template = DEFAULT_SETTINGS.template;
await this.plugin.saveSettings();
this.display();
new Notice("Template reset");
});
});

new Setting(generalSettings)
Expand Down

0 comments on commit 06df987

Please sign in to comment.