siyuan 0.7.1 → 0.7.3
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/CHANGELOG.md +46 -0
- package/README.md +2 -2
- package/package.json +3 -3
- package/siyuan.d.ts +425 -325
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v0.7.2
|
|
4
|
+
1. 更换为 SiYuan 官方 API
|
|
5
|
+
|
|
6
|
+
## v0.7.0
|
|
7
|
+
1. 添加版本自动判断
|
|
8
|
+
2. 添加插件系统内置配置页面支持插件注入
|
|
9
|
+
3. 修复export classes
|
|
10
|
+
|
|
11
|
+
## v0.5.0
|
|
12
|
+
1. 插件系统国际化
|
|
13
|
+
2. 插件支持卸载
|
|
14
|
+
3. 插件商店预览功能
|
|
15
|
+
|
|
16
|
+
## v0.4.0
|
|
17
|
+
1. 插件系统已支持浏览器使用,需思源2.8.1及以上版本。 **注意:大量插件目前对web的支持并不好,需要等待插件开发者进行适配。建议还是在桌面端使用。**
|
|
18
|
+
2. 升级过程中将原版代码挂件loader迁移到挂件版路径,但不会下载挂件。
|
|
19
|
+
3. 挂件版用户记得更新到最新版本挂件
|
|
20
|
+
|
|
21
|
+
## v0.3.21
|
|
22
|
+
+ 挂件版本不进行自动升级,即使勾选了自动升级功能
|
|
23
|
+
|
|
24
|
+
## v0.3.20
|
|
25
|
+
+ 新增功能:命令面板
|
|
26
|
+
+ 重构:修改vite构建脚本,移除dist
|
|
27
|
+
|
|
28
|
+
## v0.3.19
|
|
29
|
+
+ 修改图标
|
|
30
|
+
+ eslint重构代码
|
|
31
|
+
|
|
32
|
+
## v0.3.13
|
|
33
|
+
+ 增加插件商店,并可配置插件商店地址
|
|
34
|
+
+ 暴露PluginSystem及Ioc容器到window对象
|
|
35
|
+
|
|
36
|
+
## v0.3.12
|
|
37
|
+
+ 重构API接口,支持自动化导出api类型声明
|
|
38
|
+
|
|
39
|
+
## v0.3.11
|
|
40
|
+
+ 增加通过Plugin继承调用registerCommand,实现插件快捷键注册。未来将通过此方式开发命令面板。
|
|
41
|
+
|
|
42
|
+
## v0.3.10
|
|
43
|
+
+ 修复没有plugins时初次安装遇到的问题
|
|
44
|
+
|
|
45
|
+
## v0.3.9
|
|
46
|
+
+ 适配思源2.7.7,调整配置界面布局
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# SiYuan Plugin API
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Here is the API declaration of SiYuan Plugin System, usages please refer to [SiYuan plugin sample](https://github.com/siyuan-note/plugin-sample).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "siyuan",
|
|
3
|
-
"
|
|
3
|
+
"contributors": ["zuoez02", "Vanessa"],
|
|
4
4
|
"types": "siyuan.d.ts",
|
|
5
|
-
"version": "0.7.
|
|
6
|
-
"repository": "https://github.com/siyuan-note/petal
|
|
5
|
+
"version": "0.7.3",
|
|
6
|
+
"repository": "https://github.com/siyuan-note/petal"
|
|
7
7
|
}
|
package/siyuan.d.ts
CHANGED
|
@@ -1,344 +1,444 @@
|
|
|
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" | "loaded-protyle"
|
|
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
|
+
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
|
+
setting: Setting;
|
|
194
|
+
|
|
195
|
+
constructor(options: {
|
|
196
|
+
app: App,
|
|
197
|
+
name: string,
|
|
198
|
+
i18n: IObject
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
onload(): void;
|
|
202
|
+
|
|
203
|
+
onunload(): void;
|
|
204
|
+
|
|
205
|
+
onLayoutReady(): void;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Must be executed before the synchronous function.
|
|
209
|
+
* @param {string} [options.position=right]
|
|
210
|
+
* @param {string} options.icon - Support svg id or svg tag.
|
|
211
|
+
*/
|
|
212
|
+
addTopBar(options: {
|
|
213
|
+
icon: string,
|
|
214
|
+
title: string,
|
|
215
|
+
callback: (event: MouseEvent) => void
|
|
216
|
+
position?: "right" | "left"
|
|
217
|
+
}): HTMLElement;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Must be executed before the synchronous function.
|
|
221
|
+
* @param {string} [options.position=right]
|
|
222
|
+
*/
|
|
223
|
+
addStatusBar(options: {
|
|
224
|
+
element: HTMLElement,
|
|
225
|
+
position?: "right" | "left"
|
|
226
|
+
}): HTMLElement
|
|
227
|
+
|
|
228
|
+
openSetting(): void
|
|
229
|
+
|
|
230
|
+
loadData(storageName: string): Promise<any>;
|
|
231
|
+
|
|
232
|
+
saveData(storageName: string, content: any): Promise<void>;
|
|
233
|
+
|
|
234
|
+
removeData(storageName: string): Promise<any>;
|
|
235
|
+
|
|
236
|
+
addIcons(svg: string): void;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Must be executed before the synchronous function.
|
|
240
|
+
*/
|
|
241
|
+
addTab(options: {
|
|
242
|
+
type: string,
|
|
243
|
+
destroy?: () => void,
|
|
244
|
+
resize?: () => void,
|
|
245
|
+
update?: () => void,
|
|
246
|
+
init: () => void
|
|
247
|
+
}): () => IModel
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Must be executed before the synchronous function.
|
|
251
|
+
*/
|
|
252
|
+
addDock(options: {
|
|
253
|
+
config: IPluginDockTab,
|
|
254
|
+
data: any,
|
|
255
|
+
type: string,
|
|
256
|
+
destroy?: () => void,
|
|
257
|
+
resize?: () => void,
|
|
258
|
+
update?: () => void,
|
|
259
|
+
init: () => void
|
|
260
|
+
}): { config: IPluginDockTab, model: IModel }
|
|
261
|
+
|
|
262
|
+
addCommand(options: ICommandOption): void
|
|
263
|
+
|
|
264
|
+
addFloatLayer(options: {
|
|
265
|
+
ids: string[],
|
|
266
|
+
defIds?: string[],
|
|
267
|
+
x?: number,
|
|
268
|
+
y?: number,
|
|
269
|
+
targetElement?: HTMLElement
|
|
270
|
+
}): void
|
|
152
271
|
}
|
|
153
272
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
273
|
+
export class Setting {
|
|
274
|
+
constructor(options: {
|
|
275
|
+
height?: string,
|
|
276
|
+
width?: string,
|
|
277
|
+
destroyCallback?: () => void
|
|
278
|
+
confirmCallback?: () => void
|
|
279
|
+
})
|
|
280
|
+
|
|
281
|
+
addItem(options: {
|
|
282
|
+
title: string
|
|
283
|
+
description?: string
|
|
284
|
+
actionElement?: HTMLElement
|
|
285
|
+
createActionElement?(): HTMLElement
|
|
286
|
+
}): void;
|
|
287
|
+
|
|
288
|
+
open(name: string): void;
|
|
165
289
|
}
|
|
166
290
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
}
|
|
291
|
+
export class EventBus {
|
|
292
|
+
on(type: TEventBus, listener: (event: CustomEvent<any>) => void): void;
|
|
293
|
+
|
|
294
|
+
once(type: TEventBus, listener: (event: CustomEvent<any>) => void): void;
|
|
295
|
+
|
|
296
|
+
off(type: TEventBus, listener: (event: CustomEvent<any>) => void): void;
|
|
297
|
+
|
|
298
|
+
emit(type: TEventBus, detail?: any): boolean;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export class Dialog {
|
|
302
|
+
|
|
303
|
+
element: HTMLElement;
|
|
304
|
+
|
|
305
|
+
constructor(options: {
|
|
306
|
+
title?: string,
|
|
307
|
+
transparent?: boolean,
|
|
308
|
+
content: string,
|
|
309
|
+
width?: string
|
|
310
|
+
height?: string,
|
|
311
|
+
destroyCallback?: (options?: IObject) => void
|
|
312
|
+
disableClose?: boolean
|
|
313
|
+
disableAnimation?: boolean
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
destroy(options?: IObject): void;
|
|
317
|
+
|
|
318
|
+
bindInput(inputElement: HTMLInputElement | HTMLTextAreaElement, enterEvent?: () => void): void;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export class Menu {
|
|
322
|
+
constructor(id?: string, closeCallback?: () => void);
|
|
323
|
+
|
|
324
|
+
showSubMenu(subMenuElement: HTMLElement): void;
|
|
325
|
+
|
|
326
|
+
addItem(options: IMenuItemOption): HTMLElement;
|
|
327
|
+
|
|
328
|
+
addSeparator(index?: number): void;
|
|
329
|
+
|
|
330
|
+
open(options: { x: number, y: number, h?: number, w?: number, isLeft?: boolean }): void;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @param {string} [position=all]
|
|
334
|
+
*/
|
|
335
|
+
fullscreen(position?: "bottom" | "all"): void;
|
|
336
|
+
|
|
337
|
+
close(): void;
|
|
343
338
|
}
|
|
344
339
|
|
|
340
|
+
export class Lute {
|
|
341
|
+
public static WalkStop: number;
|
|
342
|
+
public static WalkSkipChildren: number;
|
|
343
|
+
public static WalkContinue: number;
|
|
344
|
+
public static Version: string;
|
|
345
|
+
public static Caret: string;
|
|
346
|
+
|
|
347
|
+
public static New(): Lute;
|
|
348
|
+
|
|
349
|
+
public static EChartsMindmapStr(text: string): string;
|
|
350
|
+
|
|
351
|
+
public static NewNodeID(): string;
|
|
352
|
+
|
|
353
|
+
public static Sanitize(html: string): string;
|
|
354
|
+
|
|
355
|
+
public static EscapeHTMLStr(str: string): string;
|
|
356
|
+
|
|
357
|
+
public static UnEscapeHTMLStr(str: string): string;
|
|
358
|
+
|
|
359
|
+
public static GetHeadingID(node: ILuteNode): string;
|
|
360
|
+
|
|
361
|
+
public static BlockDOM2Content(html: string): string;
|
|
362
|
+
|
|
363
|
+
private constructor();
|
|
364
|
+
|
|
365
|
+
public BlockDOM2Content(text: string): string;
|
|
366
|
+
|
|
367
|
+
public BlockDOM2EscapeMarkerContent(text: string): string;
|
|
368
|
+
|
|
369
|
+
public SetTextMark(enable: boolean): void;
|
|
370
|
+
|
|
371
|
+
public SetHeadingID(enable: boolean): void;
|
|
372
|
+
|
|
373
|
+
public SetProtyleMarkNetImg(enable: boolean): void;
|
|
374
|
+
|
|
375
|
+
public SetSpellcheck(enable: boolean): void;
|
|
376
|
+
|
|
377
|
+
public SetFileAnnotationRef(enable: boolean): void;
|
|
378
|
+
|
|
379
|
+
public SetSetext(enable: boolean): void;
|
|
380
|
+
|
|
381
|
+
public SetYamlFrontMatter(enable: boolean): void;
|
|
382
|
+
|
|
383
|
+
public SetChineseParagraphBeginningSpace(enable: boolean): void;
|
|
384
|
+
|
|
385
|
+
public SetRenderListStyle(enable: boolean): void;
|
|
386
|
+
|
|
387
|
+
public SetImgPathAllowSpace(enable: boolean): void;
|
|
388
|
+
|
|
389
|
+
public SetKramdownIAL(enable: boolean): void;
|
|
390
|
+
|
|
391
|
+
public BlockDOM2Md(html: string): string;
|
|
392
|
+
|
|
393
|
+
public BlockDOM2StdMd(html: string): string;
|
|
394
|
+
|
|
395
|
+
public SetGitConflict(enable: boolean): void;
|
|
396
|
+
|
|
397
|
+
public SetSuperBlock(enable: boolean): void;
|
|
398
|
+
|
|
399
|
+
public SetTag(enable: boolean): void;
|
|
400
|
+
|
|
401
|
+
public SetMark(enable: boolean): void;
|
|
402
|
+
|
|
403
|
+
public SetSub(enable: boolean): void;
|
|
404
|
+
|
|
405
|
+
public SetSup(enable: boolean): void;
|
|
406
|
+
|
|
407
|
+
public SetBlockRef(enable: boolean): void;
|
|
408
|
+
|
|
409
|
+
public SetSanitize(enable: boolean): void;
|
|
410
|
+
|
|
411
|
+
public SetHeadingAnchor(enable: boolean): void;
|
|
412
|
+
|
|
413
|
+
public SetImageLazyLoading(imagePath: string): void;
|
|
414
|
+
|
|
415
|
+
public SetInlineMathAllowDigitAfterOpenMarker(enable: boolean): void;
|
|
416
|
+
|
|
417
|
+
public SetToC(enable: boolean): void;
|
|
418
|
+
|
|
419
|
+
public SetIndentCodeBlock(enable: boolean): void;
|
|
420
|
+
|
|
421
|
+
public SetParagraphBeginningSpace(enable: boolean): void;
|
|
422
|
+
|
|
423
|
+
public SetFootnotes(enable: boolean): void;
|
|
424
|
+
|
|
425
|
+
public SetLinkRef(enalbe: boolean): void;
|
|
426
|
+
|
|
427
|
+
public SetEmojiSite(emojiSite: string): void;
|
|
428
|
+
|
|
429
|
+
public PutEmojis(emojis: IObject): void;
|
|
430
|
+
|
|
431
|
+
public SpinBlockDOM(html: string): string;
|
|
432
|
+
|
|
433
|
+
public Md2BlockDOM(html: string): string;
|
|
434
|
+
|
|
435
|
+
public SetProtyleWYSIWYG(wysiwyg: boolean): void;
|
|
436
|
+
|
|
437
|
+
public MarkdownStr(name: string, md: string): string;
|
|
438
|
+
|
|
439
|
+
public IsValidLinkDest(text: string): boolean;
|
|
440
|
+
|
|
441
|
+
public BlockDOM2InlineBlockDOM(html: string): string;
|
|
442
|
+
|
|
443
|
+
public BlockDOM2HTML(html: string): string;
|
|
444
|
+
}
|