generated from RyotaUshio/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8258ee2
commit bfa04c2
Showing
5 changed files
with
71 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { PluginSettingTab, Setting } from 'obsidian'; | ||
import MyPlugin from 'main'; | ||
|
||
|
||
export interface MathInCalloutSettings { | ||
notification: boolean; | ||
} | ||
|
||
export const DEFAULT_SETTINGS: MathInCalloutSettings = { | ||
notification: true, | ||
}; | ||
|
||
// Inspired by https://stackoverflow.com/a/50851710/13613783 | ||
export type KeysOfType<Obj, Type> = NonNullable<{ [k in keyof Obj]: Obj[k] extends Type ? k : never }[keyof Obj]>; | ||
|
||
export class MathInCalloutSettingTab extends PluginSettingTab { | ||
constructor(public plugin: MyPlugin) { | ||
super(plugin.app, plugin); | ||
} | ||
|
||
display(): void { | ||
this.containerEl.empty(); | ||
|
||
new Setting(this.containerEl) | ||
.setDesc('If something is not working, type some math expression outside callouts in Live Preview.') | ||
|
||
new Setting(this.containerEl) | ||
.setName("Show setup guidance notifications") | ||
.addToggle((toggle) => { | ||
toggle.setValue(this.plugin.settings.notification) | ||
.onChange(async (value) => { | ||
this.plugin.settings.notification = value; | ||
await this.plugin.saveSettings(); | ||
this.plugin.showNotReadyNotice(); | ||
}); | ||
}); | ||
} | ||
} |