-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHackMdSettingsTab.ts
43 lines (38 loc) · 1.02 KB
/
HackMdSettingsTab.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { App, PluginSettingTab, Setting } from "obsidian";
import HackMdPlugin from "main";
/**
* Setting Pane
*/
export class HackMdSettingsTab extends PluginSettingTab {
plugin: HackMdPlugin;
constructor(app: App, plugin: HackMdPlugin) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
const { containerEl } = this;
containerEl.empty();
containerEl.createEl("h2", { text: "Settings" });
containerEl.createEl("p", {
text: "To interact with your HackMD account create an access token.",
});
containerEl.createEl("a", {
text: "Create access token",
href: "https://hackmd.io/settings#api",
});
new Setting(containerEl)
.setName("Access Token")
.setDesc(
"Free plan includes call limit of 2000. Call limit resets every 30 days."
)
.addText((text) =>
text
.setPlaceholder("Paste token here")
.setValue(this.plugin.settings.API_KEY)
.onChange(async (value) => {
this.plugin.settings.API_KEY = value;
await this.plugin.saveSettings();
})
);
}
}