siyuan 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/siyuan.d.ts +405 -325
package/package.json
CHANGED
package/siyuan.d.ts
CHANGED
|
@@ -1,344 +1,424 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { clientApi, serverApi, Menu, MenuItem, MenuSeparator, Notification, Dialog, Plugin };
|
|
11
|
-
const _default: {
|
|
12
|
-
clientApi: typeof clientApi;
|
|
13
|
-
serverApi: typeof serverApi;
|
|
14
|
-
Plugin: typeof Plugin;
|
|
15
|
-
Menu: typeof Menu;
|
|
16
|
-
MenuItem: typeof MenuItem;
|
|
17
|
-
MenuSeparator: typeof MenuSeparator;
|
|
18
|
-
Notification: typeof Notification;
|
|
19
|
-
Dialog: typeof Dialog;
|
|
20
|
-
};
|
|
21
|
-
export default _default;
|
|
1
|
+
type TEventBus = "ws-main" | "click-blockicon" | "click-editorcontent" | "click-pdf" |
|
|
2
|
+
"click-editortitleicon" | "open-noneditableblock"
|
|
3
|
+
|
|
4
|
+
type TCardType = "doc" | "notebook" | "all"
|
|
5
|
+
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
Lute: Lute
|
|
9
|
+
}
|
|
22
10
|
}
|
|
23
11
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export function setNotebookConf(notebookId: any): Promise<any>;
|
|
38
|
-
export function renameDoc(notebookId: any, path: any, title: any): Promise<any>;
|
|
39
|
-
export function removeDoc(notebookId: any, path: any): Promise<any>;
|
|
40
|
-
export function moveDoc(srcNotebookId: any, srcPath: any, targetNotebookId: any, targetPath: any): Promise<any>;
|
|
41
|
-
export function getHPathByPath(notebookId: any, path: any): Promise<any>;
|
|
42
|
-
export function getHPathByID(ID: any): Promise<any>;
|
|
43
|
-
export function getBlockAttrs(blockId: any): Promise<any>;
|
|
44
|
-
export function getBlockByID(blockId: any): Promise<any>;
|
|
45
|
-
export function getBlockKramdown(blockId: any): Promise<any>;
|
|
46
|
-
export function getBlockBreadcrumb(ID: any): Promise<any>;
|
|
47
|
-
export function setBlockAttrs(blockId: any, attrs: any): Promise<any>;
|
|
48
|
-
export function exportMdContent(docId: any): Promise<any>;
|
|
49
|
-
export function getDocOutline(docId: any): Promise<any>;
|
|
50
|
-
export function listDocsByPath(path: any): Promise<any>;
|
|
51
|
-
export function getBacklink(id: any): Promise<any>;
|
|
52
|
-
export function searchEmbedBlock(excludeIds: any, sql: any): Promise<any>;
|
|
53
|
-
export function getDoc(id: any): Promise<any>;
|
|
54
|
-
export function getFocusedDoc(id: any): Promise<any>;
|
|
55
|
-
export function getTag(): Promise<any>;
|
|
56
|
-
export function getLocalGraph(k: any, id: any, conf: any, reqId: any): Promise<any>;
|
|
57
|
-
export function getGraph(k: any, conf: any, reqId: any): Promise<any>;
|
|
58
|
-
export function searchDocs(k: any): Promise<any>;
|
|
59
|
-
export function searchBlock(query: any): Promise<any>;
|
|
60
|
-
export function searchTemplate(k: any): Promise<any>;
|
|
61
|
-
export function createDocWithMd(notebook: any, path: any, markdown: any): Promise<any>;
|
|
62
|
-
export function docSaveAsTemplate(id: any, overwrite?: boolean): Promise<any>;
|
|
63
|
-
export function render(data: any): Promise<any>;
|
|
64
|
-
export function insertBlock(previousID: any, dataType: any, data: any): Promise<any>;
|
|
65
|
-
export function prependBlock(parentID: any, dataType: any, data: any): Promise<any>;
|
|
66
|
-
export function appendBlock(parentID: any, dataType: any, data: any): Promise<any>;
|
|
67
|
-
export function updateBlock(id: any, dataType: any, data: any): Promise<any>;
|
|
68
|
-
export function deleteBlock(id: any): Promise<any>;
|
|
69
|
-
export function moveBlock(id: string, previousID: string, parentID: string): Promise<any>;
|
|
70
|
-
export function getSysFonts(): Promise<any>;
|
|
71
|
-
export function getFile(path: string, type?: 'json' | 'text'): Promise<any>;
|
|
72
|
-
export function putFile(path: any, filedata: any, isDir?: boolean, modTime?: number): Promise<any>;
|
|
73
|
-
export function readDir(path: string): Promise<any>;
|
|
74
|
-
export function removeFile(path: any): Promise<any>;
|
|
75
|
-
export function pushMsg(message?: any, text?: any, timeout?: number): Promise<any>;
|
|
76
|
-
export function pushErrMsg(message?: any, text?: any, timeout?: number): Promise<any>;
|
|
77
|
-
export function setStorageVal(key: string, val: any): Promise<any>;
|
|
78
|
-
export function getLocalStorage(): Promise<any>;
|
|
79
|
-
export function renderSprig(sprig: string): Promise<any>;
|
|
80
|
-
export function getBazzarWidget(): Promise<any>;
|
|
12
|
+
interface ITab {
|
|
13
|
+
id: string;
|
|
14
|
+
headElement: HTMLElement;
|
|
15
|
+
panelElement: HTMLElement;
|
|
16
|
+
model: IModel;
|
|
17
|
+
title: string;
|
|
18
|
+
icon: string;
|
|
19
|
+
docIcon: string;
|
|
20
|
+
updateTitle: (title: string) => void;
|
|
21
|
+
pin: () => void;
|
|
22
|
+
unpin: () => void;
|
|
23
|
+
setDocIcon: (icon: string) => void;
|
|
24
|
+
close: () => void;
|
|
81
25
|
}
|
|
82
26
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
27
|
+
interface IModel {
|
|
28
|
+
element: Element;
|
|
29
|
+
tab: ITab;
|
|
30
|
+
data: any;
|
|
31
|
+
type: string;
|
|
87
32
|
}
|
|
88
33
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
34
|
+
interface IObject {
|
|
35
|
+
[key: string]: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface ILuteNode {
|
|
39
|
+
TokensStr: () => string;
|
|
40
|
+
__internal_object__: {
|
|
41
|
+
Parent: {
|
|
42
|
+
Type: number,
|
|
43
|
+
},
|
|
44
|
+
HeadingLevel: string,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ISearchOption {
|
|
49
|
+
page?: number
|
|
50
|
+
group?: number, // 0:不分组,1:按文档分组
|
|
51
|
+
hasReplace?: boolean,
|
|
52
|
+
method?: number // 0:文本,1:查询语法,2:SQL,3:正则表达式
|
|
53
|
+
hPath?: string
|
|
54
|
+
idPath?: string[]
|
|
55
|
+
k: string
|
|
56
|
+
r?: string
|
|
57
|
+
types?: {
|
|
58
|
+
mathBlock: boolean
|
|
59
|
+
table: boolean
|
|
60
|
+
blockquote: boolean
|
|
61
|
+
superBlock: boolean
|
|
62
|
+
paragraph: boolean
|
|
63
|
+
document: boolean
|
|
64
|
+
heading: boolean
|
|
65
|
+
list: boolean
|
|
66
|
+
listItem: boolean
|
|
67
|
+
codeBlock: boolean
|
|
68
|
+
htmlBlock: boolean
|
|
69
|
+
embedBlock: boolean
|
|
115
70
|
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface IWebSocketData {
|
|
74
|
+
cmd: string
|
|
75
|
+
callback?: string
|
|
76
|
+
data: any
|
|
77
|
+
msg: string
|
|
78
|
+
code: number
|
|
79
|
+
sid: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
declare interface IPluginDockTab {
|
|
83
|
+
position: "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight",
|
|
84
|
+
size: { width: number, height: number },
|
|
85
|
+
icon: string,
|
|
86
|
+
hotkey?: string,
|
|
87
|
+
title: string,
|
|
88
|
+
index?: number,
|
|
89
|
+
show?: boolean
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
interface IMenuItemOption {
|
|
93
|
+
label?: string,
|
|
94
|
+
click?: (element: HTMLElement) => void,
|
|
95
|
+
type?: "separator" | "submenu" | "readonly",
|
|
96
|
+
accelerator?: string,
|
|
97
|
+
action?: string,
|
|
98
|
+
id?: string,
|
|
99
|
+
submenu?: IMenuItemOption[]
|
|
100
|
+
disabled?: boolean
|
|
101
|
+
icon?: string
|
|
102
|
+
iconHTML?: string
|
|
103
|
+
current?: boolean
|
|
104
|
+
bind?: (element: HTMLElement) => void
|
|
105
|
+
index?: number
|
|
106
|
+
element?: HTMLElement
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
interface ICommandOption {
|
|
110
|
+
langKey: string, // 多语言 key
|
|
116
111
|
/**
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
112
|
+
* 目前需使用 MacOS 符号标识,顺序按照 ⌥⇧⌘,入 ⌥⇧⌘A
|
|
113
|
+
* "Ctrl": "⌘",
|
|
114
|
+
* "Shift": "⇧",
|
|
115
|
+
* "Alt": "⌥",
|
|
116
|
+
* "Tab": "⇥",
|
|
117
|
+
* "Backspace": "⌫",
|
|
118
|
+
* "Delete": "⌦",
|
|
119
|
+
* "Enter": "↩",
|
|
120
|
+
*/
|
|
121
|
+
hotkey: string,
|
|
122
|
+
customHotkey?: string,
|
|
123
|
+
callback?: () => void
|
|
124
|
+
fileTreeCallback?: (file: any) => void
|
|
125
|
+
editorCallback?: (protyle: any) => void
|
|
126
|
+
dockCallback?: (element: HTMLElement) => void
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
129
|
+
export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
|
|
130
|
+
|
|
131
|
+
export function fetchSyncPost(url: string, data?: any): Promise<IWebSocketData>;
|
|
132
|
+
|
|
133
|
+
export function fetchGet(url: string, callback: (response: IWebSocketData) => void): void;
|
|
134
|
+
|
|
135
|
+
export function openTab(options: {
|
|
136
|
+
app: App,
|
|
137
|
+
doc?: {
|
|
138
|
+
id: string, // 块 id
|
|
139
|
+
action?: string [] // cb-get-all:获取所有内容;cb-get-focus:打开后光标定位在 id 所在的块;cb-get-hl: 打开后 id 块高亮
|
|
140
|
+
zoomIn?: boolean // 是否缩放
|
|
141
|
+
},
|
|
142
|
+
pdf?: {
|
|
143
|
+
path: string,
|
|
144
|
+
page?: number, // pdf 页码
|
|
145
|
+
id?: string, // File Annotation id
|
|
146
|
+
},
|
|
147
|
+
asset?: {
|
|
148
|
+
path: string,
|
|
149
|
+
},
|
|
150
|
+
search?: ISearchOption
|
|
151
|
+
card?: {
|
|
152
|
+
type: TCardType,
|
|
153
|
+
id?: string, // cardType 为 all 时不传,否则传文档或笔记本 id
|
|
154
|
+
title?: string // cardType 为 all 时不传,否则传文档或笔记本名称
|
|
155
|
+
},
|
|
156
|
+
custom?: {
|
|
157
|
+
title: string,
|
|
158
|
+
icon: string,
|
|
159
|
+
data?: any
|
|
160
|
+
fn?: () => IModel,
|
|
143
161
|
}
|
|
162
|
+
position?: "right" | "bottom",
|
|
163
|
+
keepCursor?: boolean // 是否跳转到新 tab 上
|
|
164
|
+
removeCurrentTab?: boolean // 在当前页签打开时需移除原有页签
|
|
165
|
+
afterOpen?: () => void // 打开后回调
|
|
166
|
+
}): ITab
|
|
167
|
+
|
|
168
|
+
export function getFrontend(): "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile";
|
|
169
|
+
|
|
170
|
+
export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios"
|
|
171
|
+
|
|
172
|
+
export function adaptHotkey(hotkey: string): string;
|
|
173
|
+
|
|
174
|
+
export function confirm(title: string, text: string, confirmCallback?: () => void, cancelCallback?: () => void): void;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @param timeout - ms. 0: manual close;-1: always show; 6000: default
|
|
178
|
+
* @param {string} [type=info]
|
|
179
|
+
*/
|
|
180
|
+
export function showMessage(text: string, timeout?: number, type?: "info" | "error", id?: string): void;
|
|
181
|
+
|
|
182
|
+
export class App {
|
|
183
|
+
plugins: Plugin[];
|
|
144
184
|
}
|
|
145
185
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
186
|
+
export abstract class Plugin {
|
|
187
|
+
eventBus: EventBus;
|
|
188
|
+
i18n: IObject;
|
|
189
|
+
data: any;
|
|
190
|
+
name: string;
|
|
191
|
+
app: App;
|
|
192
|
+
commands: ICommandOption[];
|
|
193
|
+
|
|
194
|
+
constructor(options: {
|
|
195
|
+
app: App,
|
|
196
|
+
name: string,
|
|
197
|
+
i18n: IObject
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
onload(): void;
|
|
201
|
+
|
|
202
|
+
onunload(): void;
|
|
203
|
+
|
|
204
|
+
onLayoutReady(): void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Must be executed before the synchronous function.
|
|
208
|
+
* @param {string} [options.position=right]
|
|
209
|
+
*/
|
|
210
|
+
addTopBar(options: {
|
|
211
|
+
icon: string,
|
|
212
|
+
title: string,
|
|
213
|
+
callback: (event: MouseEvent) => void
|
|
214
|
+
position?: "right" | "left"
|
|
215
|
+
}): HTMLElement;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Must be executed before the synchronous function.
|
|
219
|
+
* @param {string} [options.position=right]
|
|
220
|
+
*/
|
|
221
|
+
addStatusBar(options: {
|
|
222
|
+
element: HTMLElement,
|
|
223
|
+
position?: "right" | "left"
|
|
224
|
+
}): HTMLElement
|
|
225
|
+
|
|
226
|
+
openSetting(): void
|
|
227
|
+
|
|
228
|
+
loadData(storageName: string): Promise<any>;
|
|
229
|
+
|
|
230
|
+
saveData(storageName: string, content: any): Promise<void>;
|
|
231
|
+
|
|
232
|
+
removeData(storageName: string): Promise<any>;
|
|
233
|
+
|
|
234
|
+
addIcons(svg: string): void;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Must be executed before the synchronous function.
|
|
238
|
+
*/
|
|
239
|
+
addTab(options: {
|
|
240
|
+
type: string,
|
|
241
|
+
destroy?: () => void,
|
|
242
|
+
resize?: () => void,
|
|
243
|
+
update?: () => void,
|
|
244
|
+
init: () => void
|
|
245
|
+
}): () => IModel
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Must be executed before the synchronous function.
|
|
249
|
+
*/
|
|
250
|
+
addDock(options: {
|
|
251
|
+
config: IPluginDockTab,
|
|
252
|
+
data: any,
|
|
253
|
+
type: string,
|
|
254
|
+
destroy?: () => void,
|
|
255
|
+
resize?: () => void,
|
|
256
|
+
update?: () => void,
|
|
257
|
+
init: () => void
|
|
258
|
+
}): { config: IPluginDockTab, model: IModel }
|
|
259
|
+
|
|
260
|
+
addCommand(options: ICommandOption): void
|
|
261
|
+
|
|
262
|
+
addFloatLayer(options: {
|
|
263
|
+
ids: string[],
|
|
264
|
+
defIds?: string[],
|
|
265
|
+
x?: number,
|
|
266
|
+
y?: number,
|
|
267
|
+
targetElement?: HTMLElement
|
|
268
|
+
}): void
|
|
152
269
|
}
|
|
153
270
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
loadStorage(filename: string): Promise<any>;
|
|
163
|
-
writeStorage(filename: string, content: any): Promise<void>;
|
|
164
|
-
}
|
|
271
|
+
export class EventBus {
|
|
272
|
+
on(type: TEventBus, listener: (event: CustomEvent<any>) => void): void;
|
|
273
|
+
|
|
274
|
+
once(type: TEventBus, listener: (event: CustomEvent<any>) => void): void;
|
|
275
|
+
|
|
276
|
+
off(type: TEventBus, listener: (event: CustomEvent<any>) => void): void;
|
|
277
|
+
|
|
278
|
+
emit(type: TEventBus, detail?: any): boolean;
|
|
165
279
|
}
|
|
166
280
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
url: string;
|
|
186
|
-
}
|
|
187
|
-
export interface StorePluginStatus extends StorePluginManifest {
|
|
188
|
-
isExist: boolean;
|
|
189
|
-
needUpgrade: boolean;
|
|
190
|
-
}
|
|
191
|
-
export interface PluginManifest {
|
|
192
|
-
key: string;
|
|
193
|
-
name: string;
|
|
194
|
-
version: string;
|
|
195
|
-
script?: string;
|
|
196
|
-
enabled?: boolean;
|
|
197
|
-
hidden?: boolean;
|
|
198
|
-
description?: string;
|
|
199
|
-
url?: string;
|
|
200
|
-
author?: string;
|
|
201
|
-
plugin?: new (...args: any) => IPlugin;
|
|
202
|
-
}
|
|
203
|
-
export interface IStorageManager {
|
|
204
|
-
get(key: keyof PluginConfig): any;
|
|
205
|
-
set(key: string, val: any): Promise<void>;
|
|
206
|
-
initStorage(): Promise<IStorageManager>;
|
|
207
|
-
getPlugins(): PluginManifest[];
|
|
208
|
-
getInternalPlugins(): PluginManifest[];
|
|
209
|
-
getThirdPartyPlugins(): PluginManifest[];
|
|
210
|
-
getPluginByKey(key: string): PluginManifest | undefined;
|
|
211
|
-
setPluginEnabled(key: string, enabled: boolean): Promise<void>;
|
|
212
|
-
savePluginsEnabled(): Promise<void>;
|
|
213
|
-
setSafeModeEnabled(enabled: boolean): Promise<void>;
|
|
214
|
-
setPluginStorage(pluginKey: string, filename: string, content: any): Promise<void>;
|
|
215
|
-
getPluginStorage(pluginKey: string, filename: string): Promise<Response>;
|
|
216
|
-
uninstallPlugin(key: string): Promise<void>;
|
|
217
|
-
}
|
|
218
|
-
export interface ISystemManager {
|
|
219
|
-
saveToLocal(p: string, content: string): Promise<void>;
|
|
220
|
-
localCacheInit(): Promise<void>;
|
|
221
|
-
delayAutoUpgrade(): void;
|
|
222
|
-
tryUpgrade(): Promise<void>;
|
|
223
|
-
getOnlineVersion(): Promise<string>;
|
|
224
|
-
upgrade(): Promise<void>;
|
|
225
|
-
}
|
|
226
|
-
export interface IPluginSystem {
|
|
227
|
-
init(): Promise<IPluginSystem>;
|
|
228
|
-
loadPlugin(key: string): Promise<void>;
|
|
229
|
-
unloadPlugin(key: string): Promise<void>;
|
|
230
|
-
turnOffSafeMode(): Promise<void>;
|
|
231
|
-
turnOnSafeMode(): Promise<void>;
|
|
232
|
-
}
|
|
233
|
-
export interface IPluginLoader {
|
|
234
|
-
loadEnabledPlugins(plugins: PluginManifest[]): Promise<void>;
|
|
235
|
-
loadAllInternalPlugins(): Promise<void>;
|
|
236
|
-
loadAllLocalPlugins(): Promise<void>;
|
|
237
|
-
loadPlugin(plugin: PluginManifest): Promise<void>;
|
|
238
|
-
unloadPlugin(key: string): Promise<void>;
|
|
239
|
-
generateRequiredModules(): void;
|
|
240
|
-
unloadThirdPartyPlugins(plugins: PluginManifest[]): Promise<void>;
|
|
241
|
-
loadThirdPartyEnabledPlugins(plugins: PluginManifest[]): Promise<void>;
|
|
242
|
-
}
|
|
243
|
-
export interface IPluginFileManager {
|
|
244
|
-
scanPlugins(pluginFolder: string): Promise<string[]>;
|
|
245
|
-
getFileContent(f: string): Promise<string>;
|
|
246
|
-
getManifest(f: string): Promise<any>;
|
|
247
|
-
getScript(f: string): Promise<string>;
|
|
248
|
-
getAllPlugins(): Promise<PluginManifest[]>;
|
|
249
|
-
}
|
|
250
|
-
export interface ISettingTab {
|
|
251
|
-
key: string;
|
|
252
|
-
name: string;
|
|
253
|
-
settings: ISetting[];
|
|
254
|
-
}
|
|
255
|
-
export interface ISetting<T extends ISettingType = any> {
|
|
256
|
-
key: string;
|
|
257
|
-
name: string;
|
|
258
|
-
type: T;
|
|
259
|
-
value: T extends 'boolean' ? boolean : T extends 'string' ? string : T extends 'array' ? Array<any> : T extends 'number' ? number : any;
|
|
260
|
-
}
|
|
261
|
-
export enum ISettingType {
|
|
262
|
-
BOOLEAN = "boolean",
|
|
263
|
-
STRING = "string",
|
|
264
|
-
ARRAY = "array",
|
|
265
|
-
NUMBER = "number"
|
|
266
|
-
}
|
|
267
|
-
export interface PluginEnableConfig {
|
|
268
|
-
key: string;
|
|
269
|
-
enabled: boolean;
|
|
270
|
-
}
|
|
271
|
-
export interface PluginConfig {
|
|
272
|
-
PLUGIN_SYSTEM_SAFE_MODE_ENABLED: boolean;
|
|
273
|
-
PLUGIN_SYSTEM_AUTO_UPDATE: boolean;
|
|
274
|
-
PLUGIN_SYSTEM_PLUGIN: Array<PluginEnableConfig>;
|
|
275
|
-
PLUGIN_SYSTEM_THIRD_PARTY_PLUGIN: Array<PluginEnableConfig>;
|
|
276
|
-
PLUGIN_STORE_URL: string;
|
|
277
|
-
}
|
|
278
|
-
export type Listener = (...args: any) => void;
|
|
279
|
-
export interface IEventBus {
|
|
280
|
-
on(eventName: string, callback: Listener): () => void;
|
|
281
|
-
off(eventName: string, callback?: Listener): void;
|
|
282
|
-
emit(eventName: string, ...args: any): void;
|
|
283
|
-
destroy(): void;
|
|
284
|
-
}
|
|
285
|
-
export interface Command {
|
|
286
|
-
plugin: string;
|
|
287
|
-
pluginName: string;
|
|
288
|
-
command: string;
|
|
289
|
-
shortcut?: string;
|
|
290
|
-
description?: string;
|
|
291
|
-
callback: (...args: any[]) => any;
|
|
292
|
-
}
|
|
293
|
-
export interface IPluginCommand {
|
|
294
|
-
command: string;
|
|
295
|
-
shortcut?: string;
|
|
296
|
-
description?: string;
|
|
297
|
-
callback: (...args: any[]) => any;
|
|
298
|
-
}
|
|
299
|
-
export interface ICommandManager {
|
|
300
|
-
registerCommand(command: Command): any;
|
|
301
|
-
unregisterCommand(command: Command): any;
|
|
302
|
-
unregisterCommandByPlugin(plugin: string): any;
|
|
303
|
-
getCommands(): Command[];
|
|
304
|
-
}
|
|
305
|
-
export interface IShortcut {
|
|
306
|
-
registerKeyboardEvent(shortcut: string, callback: (e: KeyboardEvent) => void): any;
|
|
307
|
-
unregisterKeyboardEvent(shortcut: string): any;
|
|
308
|
-
registerKeyboardEventFromPlugin(command: Command): any;
|
|
309
|
-
unregisterKeyboardEventFromPlugin(command: Command): any;
|
|
310
|
-
}
|
|
311
|
-
export interface INotification {
|
|
312
|
-
show(): void;
|
|
313
|
-
}
|
|
314
|
-
export interface INoticationOption {
|
|
315
|
-
type: 'error' | 'info';
|
|
316
|
-
message: string;
|
|
317
|
-
timeout?: number;
|
|
318
|
-
}
|
|
319
|
-
export interface IStore {
|
|
320
|
-
init(): Promise<void>;
|
|
321
|
-
getStoreUrl(): string;
|
|
322
|
-
getPlugins(): StorePluginManifest[];
|
|
323
|
-
loadPlugins(): Promise<StorePluginManifest[]>;
|
|
324
|
-
getPluginsWithStatus(): StorePluginManifest[];
|
|
325
|
-
loadPluginsFromUrl(): Promise<void>;
|
|
326
|
-
getPluginByUrl(url: string): Promise<{
|
|
327
|
-
manifest: string;
|
|
328
|
-
mainJs: string;
|
|
329
|
-
}>;
|
|
330
|
-
getPluginManifest(url: string): Promise<PluginManifest>;
|
|
331
|
-
getPluginReadme(url: string): Promise<string>;
|
|
332
|
-
downloadPlugin(key: string): Promise<any>;
|
|
333
|
-
}
|
|
334
|
-
export type SettingRender = (element: HTMLElement) => void;
|
|
335
|
-
export interface ISettingManager {
|
|
336
|
-
registerSetting(key: string, settingRender: SettingRender): void;
|
|
337
|
-
unregisterSetting(key: string): void;
|
|
338
|
-
getSettingRenders(): Array<{
|
|
339
|
-
key: string;
|
|
340
|
-
value: SettingRender;
|
|
341
|
-
}>;
|
|
342
|
-
}
|
|
281
|
+
export class Dialog {
|
|
282
|
+
|
|
283
|
+
element: HTMLElement;
|
|
284
|
+
|
|
285
|
+
constructor(options: {
|
|
286
|
+
title?: string,
|
|
287
|
+
transparent?: boolean,
|
|
288
|
+
content: string,
|
|
289
|
+
width?: string
|
|
290
|
+
height?: string,
|
|
291
|
+
destroyCallback?: (options?: IObject) => void
|
|
292
|
+
disableClose?: boolean
|
|
293
|
+
disableAnimation?: boolean
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
destroy(options?: IObject): void;
|
|
297
|
+
|
|
298
|
+
bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void): void;
|
|
343
299
|
}
|
|
344
300
|
|
|
301
|
+
export class Menu {
|
|
302
|
+
constructor(id?: string, closeCallback?: () => void);
|
|
303
|
+
|
|
304
|
+
showSubMenu(subMenuElement: HTMLElement): void;
|
|
305
|
+
|
|
306
|
+
addItem(options: IMenuItemOption): HTMLElement;
|
|
307
|
+
|
|
308
|
+
addSeparator(index?: number): void;
|
|
309
|
+
|
|
310
|
+
open(options: { x: number, y: number, h?: number, w?: number, isLeft?: boolean }): void;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* @param {string} [position=all]
|
|
314
|
+
*/
|
|
315
|
+
fullscreen(position?: "bottom" | "all"): void;
|
|
316
|
+
|
|
317
|
+
close(): void;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
declare class Lute {
|
|
321
|
+
public static WalkStop: number;
|
|
322
|
+
public static WalkSkipChildren: number;
|
|
323
|
+
public static WalkContinue: number;
|
|
324
|
+
public static Version: string;
|
|
325
|
+
public static Caret: string;
|
|
326
|
+
|
|
327
|
+
public static New(): Lute;
|
|
328
|
+
|
|
329
|
+
public static EChartsMindmapStr(text: string): string;
|
|
330
|
+
|
|
331
|
+
public static NewNodeID(): string;
|
|
332
|
+
|
|
333
|
+
public static Sanitize(html: string): string;
|
|
334
|
+
|
|
335
|
+
public static EscapeHTMLStr(str: string): string;
|
|
336
|
+
|
|
337
|
+
public static UnEscapeHTMLStr(str: string): string;
|
|
338
|
+
|
|
339
|
+
public static GetHeadingID(node: ILuteNode): string;
|
|
340
|
+
|
|
341
|
+
public static BlockDOM2Content(html: string): string;
|
|
342
|
+
|
|
343
|
+
private constructor();
|
|
344
|
+
|
|
345
|
+
public BlockDOM2Content(text: string): string;
|
|
346
|
+
|
|
347
|
+
public BlockDOM2EscapeMarkerContent(text: string): string;
|
|
348
|
+
|
|
349
|
+
public SetTextMark(enable: boolean): void;
|
|
350
|
+
|
|
351
|
+
public SetHeadingID(enable: boolean): void;
|
|
352
|
+
|
|
353
|
+
public SetProtyleMarkNetImg(enable: boolean): void;
|
|
354
|
+
|
|
355
|
+
public SetSpellcheck(enable: boolean): void;
|
|
356
|
+
|
|
357
|
+
public SetFileAnnotationRef(enable: boolean): void;
|
|
358
|
+
|
|
359
|
+
public SetSetext(enable: boolean): void;
|
|
360
|
+
|
|
361
|
+
public SetYamlFrontMatter(enable: boolean): void;
|
|
362
|
+
|
|
363
|
+
public SetChineseParagraphBeginningSpace(enable: boolean): void;
|
|
364
|
+
|
|
365
|
+
public SetRenderListStyle(enable: boolean): void;
|
|
366
|
+
|
|
367
|
+
public SetImgPathAllowSpace(enable: boolean): void;
|
|
368
|
+
|
|
369
|
+
public SetKramdownIAL(enable: boolean): void;
|
|
370
|
+
|
|
371
|
+
public BlockDOM2Md(html: string): string;
|
|
372
|
+
|
|
373
|
+
public BlockDOM2StdMd(html: string): string;
|
|
374
|
+
|
|
375
|
+
public SetGitConflict(enable: boolean): void;
|
|
376
|
+
|
|
377
|
+
public SetSuperBlock(enable: boolean): void;
|
|
378
|
+
|
|
379
|
+
public SetTag(enable: boolean): void;
|
|
380
|
+
|
|
381
|
+
public SetMark(enable: boolean): void;
|
|
382
|
+
|
|
383
|
+
public SetSub(enable: boolean): void;
|
|
384
|
+
|
|
385
|
+
public SetSup(enable: boolean): void;
|
|
386
|
+
|
|
387
|
+
public SetBlockRef(enable: boolean): void;
|
|
388
|
+
|
|
389
|
+
public SetSanitize(enable: boolean): void;
|
|
390
|
+
|
|
391
|
+
public SetHeadingAnchor(enable: boolean): void;
|
|
392
|
+
|
|
393
|
+
public SetImageLazyLoading(imagePath: string): void;
|
|
394
|
+
|
|
395
|
+
public SetInlineMathAllowDigitAfterOpenMarker(enable: boolean): void;
|
|
396
|
+
|
|
397
|
+
public SetToC(enable: boolean): void;
|
|
398
|
+
|
|
399
|
+
public SetIndentCodeBlock(enable: boolean): void;
|
|
400
|
+
|
|
401
|
+
public SetParagraphBeginningSpace(enable: boolean): void;
|
|
402
|
+
|
|
403
|
+
public SetFootnotes(enable: boolean): void;
|
|
404
|
+
|
|
405
|
+
public SetLinkRef(enalbe: boolean): void;
|
|
406
|
+
|
|
407
|
+
public SetEmojiSite(emojiSite: string): void;
|
|
408
|
+
|
|
409
|
+
public PutEmojis(emojis: IObject): void;
|
|
410
|
+
|
|
411
|
+
public SpinBlockDOM(html: string): string;
|
|
412
|
+
|
|
413
|
+
public Md2BlockDOM(html: string): string;
|
|
414
|
+
|
|
415
|
+
public SetProtyleWYSIWYG(wysiwyg: boolean): void;
|
|
416
|
+
|
|
417
|
+
public MarkdownStr(name: string, md: string): string;
|
|
418
|
+
|
|
419
|
+
public IsValidLinkDest(text: string): boolean;
|
|
420
|
+
|
|
421
|
+
public BlockDOM2InlineBlockDOM(html: string): string;
|
|
422
|
+
|
|
423
|
+
public BlockDOM2HTML(html: string): string;
|
|
424
|
+
}
|