mirror of
https://github.com/kotaindah55/extended-markdown-syntax.git
synced 2026-07-22 05:38:06 +00:00
refactor: use Notice instead of Setting.setDesc
This commit is contained in:
parent
6cc89e67e5
commit
1a7828e5ca
2 changed files with 6 additions and 3 deletions
5
main.ts
5
main.ts
|
|
@ -12,6 +12,7 @@ import { configureDelimLookup } from "src/utils";
|
|||
|
||||
export default class ExtendedMarkdownSyntax extends Plugin {
|
||||
settings: PluginSettings;
|
||||
areSettingsChanged: boolean = false;
|
||||
async onload() {
|
||||
await this.loadSettings();
|
||||
this.addSettingTab(new SettingTab(this.app, this));
|
||||
|
|
@ -29,6 +30,10 @@ export default class ExtendedMarkdownSyntax extends Plugin {
|
|||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
async saveSettings() {
|
||||
if (!this.areSettingsChanged) {
|
||||
this.areSettingsChanged = true;
|
||||
new Notice("You must restart the app to take the effect")
|
||||
}
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
onunload(): void {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ export class SettingTab extends PluginSettingTab {
|
|||
display(): void {
|
||||
let { containerEl } = this,
|
||||
{ settings } = this.plugin;
|
||||
this.plugin.areSettingsChanged = false;
|
||||
containerEl.empty();
|
||||
new Setting(containerEl)
|
||||
.setName("Insertion (underline)")
|
||||
|
|
@ -81,8 +82,5 @@ export class SettingTab extends PluginSettingTab {
|
|||
toggle.setValue(settings.colorButton);
|
||||
toggle.onChange((val) => { settings.colorButton = val; this.plugin.saveSettings() });
|
||||
});
|
||||
new Setting(containerEl)
|
||||
.setDesc("You must restart the app to take the effect.")
|
||||
.descEl.addClass("warning-desc");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue