-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.ts
39 lines (29 loc) · 928 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
import { Plugin } from "obsidian";
import { FileLinkSettings } from "./src/interfaces";
import { DEFAULT_SETTINGS } from "./src/constants";
import { FileLinkSettingTab } from "./src/FileLinkSettingsTab";
import { FileLinkModal } from "./src/FileLinkModal";
export default class FileLink extends Plugin {
settings: FileLinkSettings;
async onload() {
console.log("loading plugin file-link");
await this.loadSettings();
this.addSettingTab(new FileLinkSettingTab(this.app, this));
this.addCommand({
id: "add-file-link",
name: "Add File Link",
editorCallback: () => {
new FileLinkModal(this.app, this).open();
},
});
}
onunload() {
console.log("unloading plugin file-link");
}
async loadSettings() {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
}
async saveSettings() {
await this.saveData(this.settings);
}
}