-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
82 lines (81 loc) · 1.89 KB
/
index.d.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
declare enum Component {
Ribbon = "Ribbon",
LeftMenu = "LeftMenu",
PDFMenu = "PDFMenu",
PluginPage = "PluginPage"
}
interface Button {
id: string;
icon: string;
tooltip: string;
component: Component;
click: () => void;
}
interface View {
id: string;
component: Component;
mount: (container: HTMLElement) => void;
}
declare enum PageType {
LibraryPage = "LibraryPage",
ReaderPage = "ReaderPage",
NotePage = "NotePage",
ExcalidrawPage = "ExcalidrawPage",
HelpPage = "HelpPage",
SettingsPage = "SettingsPage",
PluginPage = "PluginPage"
}
interface Page {
id: string;
type: PageType;
label: string;
}
declare class Plugin {
/**
* Layout controls
*/
/**
* Toggle LeftMenu
* If visible is given, set the state as it is
* @param visible
*/
toggleLeftMenu(visible?: boolean): void;
/**
* Set the view to be shown in LeftMenu
* @param viewId - the id of the view to be shown
*/
setLeftMenuView(viewId: string): void;
/**
* Opens a page
* @param - the page to be opened
*/
openPage(page: Page): void;
/**
* Add a button
* @param button - button to be added
*/
addButton(button: Button): void;
/**
* Add a view
* @param view - must implement the mount function
*/
addView(view: View): void;
/**
* This function will be executed when plugin is enabled
*/
enable(): Promise<void>;
/**
* This function will be executed when plugin is disabled
*/
disable(): Promise<void>;
/**
* Loads data.json in the plugin folder
*/
loadData(): Promise<void>;
/**
* Save data to data.json in the plugin folder
* @param data - must be serializable
*/
saveData(data: any): Promise<void>;
}
export { type Button, Component, type Page, PageType, Plugin, type View };