-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
42 lines (36 loc) · 947 Bytes
/
main.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
import { Plugin, Button, Page, SettingInput } from "research-helper";
class SimpleMemo extends Plugin {
memoPath: string = "";
constructor(params, controller) {
super(params, controller);
this.memoPath = this.controller.path.join(
this.params.pluginPath,
"memo.md"
);
}
enable() {
let button = {
icon: "assignment",
tooltip: "Memo",
click: this.openMemo,
} as Button;
this.addRibbonBtn(button);
}
disable() {
this.controller.layout.closePage("memo");
}
openMemo() {
// If memo exists (create it if not), then open the page for it.
// No need to worry about save/load,
// since the path is in the note object,
// the note page will take care of the .md file
let page = {
id: "memo",
label: "Memo",
type: "NotePage",
data: { notePath: this.memoPath },
} as Page;
this.openPage(page);
}
}
export default SimpleMemo;