siyuan 0.8.5 → 0.8.6
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 +5 -1
- package/package.json +1 -1
- package/siyuan.d.ts +187 -180
- package/types/events.d.ts +4 -4
- package/types/index.d.ts +3 -0
- package/types/response.d.ts +10 -10
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/siyuan.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
export * from "./types";
|
|
2
|
+
|
|
1
3
|
import {IProtyle, Lute, Protyle, Toolbar} from "./types/protyle";
|
|
2
4
|
import {IMenuBaseDetail} from "./types/events";
|
|
3
5
|
import {IGetDocInfo, IGetTreeStat} from "./types/response";
|
|
4
6
|
|
|
5
7
|
declare global {
|
|
6
|
-
interface Window extends Global {
|
|
8
|
+
export interface Window extends Global {
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
type TEventBus = keyof IEventBusMap
|
|
12
|
+
export type TEventBus = keyof IEventBusMap
|
|
11
13
|
|
|
12
|
-
type TCardType = "doc" | "notebook" | "all"
|
|
14
|
+
export type TCardType = "doc" | "notebook" | "all"
|
|
13
15
|
|
|
14
|
-
type TProtyleAction = "cb-get-append" | // 向下滚动加载
|
|
16
|
+
export type TProtyleAction = "cb-get-append" | // 向下滚动加载
|
|
15
17
|
"cb-get-before" | // 向上滚动加载
|
|
16
18
|
"cb-get-unchangeid" | // 上下滚动,定位时不修改 blockid
|
|
17
19
|
"cb-get-hl" | // 高亮
|
|
@@ -26,7 +28,7 @@ type TProtyleAction = "cb-get-append" | // 向下滚动加载
|
|
|
26
28
|
"cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
|
|
27
29
|
"cb-get-history" // 历史渲染
|
|
28
30
|
|
|
29
|
-
type TOperation =
|
|
31
|
+
export type TOperation =
|
|
30
32
|
"insert"
|
|
31
33
|
| "update"
|
|
32
34
|
| "delete"
|
|
@@ -58,7 +60,7 @@ type TOperation =
|
|
|
58
60
|
| "setAttrViewColCalc"
|
|
59
61
|
| "updateAttrViewColNumberFormat"
|
|
60
62
|
|
|
61
|
-
type TAVCol =
|
|
63
|
+
export type TAVCol =
|
|
62
64
|
"text"
|
|
63
65
|
| "date"
|
|
64
66
|
| "number"
|
|
@@ -71,28 +73,30 @@ type TAVCol =
|
|
|
71
73
|
| "email"
|
|
72
74
|
| "phone"
|
|
73
75
|
|
|
74
|
-
interface Global {
|
|
76
|
+
export interface Global {
|
|
75
77
|
Lute: Lute;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
interface IEventBusMap {
|
|
80
|
+
export interface IEventBusMap {
|
|
79
81
|
"click-blockicon": {
|
|
82
|
+
menu: EventMenu,
|
|
80
83
|
protyle: IProtyle,
|
|
81
|
-
blockElements: HTMLElement[]
|
|
84
|
+
blockElements: HTMLElement[],
|
|
82
85
|
};
|
|
83
86
|
"click-editorcontent": {
|
|
84
87
|
protyle: IProtyle,
|
|
85
|
-
event: MouseEvent
|
|
88
|
+
event: MouseEvent,
|
|
86
89
|
};
|
|
87
90
|
"click-editortitleicon": {
|
|
91
|
+
menu: EventMenu,
|
|
88
92
|
protyle: IProtyle,
|
|
89
93
|
data: IGetDocInfo,
|
|
90
94
|
};
|
|
91
95
|
"click-pdf": {
|
|
92
|
-
event: MouseEvent
|
|
96
|
+
event: MouseEvent,
|
|
93
97
|
};
|
|
94
98
|
"destroy-protyle": {
|
|
95
|
-
protyle: IProtyle
|
|
99
|
+
protyle: IProtyle,
|
|
96
100
|
};
|
|
97
101
|
"input-search": {
|
|
98
102
|
protyle: Protyle,
|
|
@@ -101,12 +105,12 @@ interface IEventBusMap {
|
|
|
101
105
|
};
|
|
102
106
|
"loaded-protyle-dynamic": {
|
|
103
107
|
protyle: IProtyle,
|
|
104
|
-
positon: "afterend" | "beforebegin"
|
|
108
|
+
positon: "afterend" | "beforebegin",
|
|
105
109
|
};
|
|
106
110
|
"loaded-protyle": {
|
|
107
111
|
protyle: IProtyle,
|
|
108
112
|
};
|
|
109
|
-
"open-menu-av": IMenuBaseDetail;
|
|
113
|
+
"open-menu-av": IMenuBaseDetail & { selectRowElements: HTMLElement[] };
|
|
110
114
|
"open-menu-blockref": IMenuBaseDetail;
|
|
111
115
|
"open-menu-breadcrumbmore": {
|
|
112
116
|
menu: EventMenu,
|
|
@@ -114,18 +118,18 @@ interface IEventBusMap {
|
|
|
114
118
|
data: IGetTreeStat,
|
|
115
119
|
};
|
|
116
120
|
"open-menu-content": IMenuBaseDetail & { range: Range };
|
|
117
|
-
"open-menu-fileannotationref": IMenuBaseDetail
|
|
118
|
-
"open-menu-image": IMenuBaseDetail
|
|
119
|
-
"open-menu-link": IMenuBaseDetail
|
|
120
|
-
"open-menu-tag": IMenuBaseDetail
|
|
121
|
+
"open-menu-fileannotationref": IMenuBaseDetail;
|
|
122
|
+
"open-menu-image": IMenuBaseDetail;
|
|
123
|
+
"open-menu-link": IMenuBaseDetail;
|
|
124
|
+
"open-menu-tag": IMenuBaseDetail;
|
|
121
125
|
"open-menu-doctree": {
|
|
122
126
|
menu: EventMenu,
|
|
123
|
-
elements: NodeListOf<
|
|
124
|
-
type: "doc" | "docs" | "notebook"
|
|
127
|
+
elements: NodeListOf<HTMLElement>,
|
|
128
|
+
type: "doc" | "docs" | "notebook",
|
|
125
129
|
};
|
|
126
130
|
"open-noneditableblock": {
|
|
127
131
|
protyle: IProtyle,
|
|
128
|
-
toolbar: Toolbar
|
|
132
|
+
toolbar: Toolbar,
|
|
129
133
|
};
|
|
130
134
|
"open-siyuan-url-block": {
|
|
131
135
|
url: string,
|
|
@@ -134,20 +138,20 @@ interface IEventBusMap {
|
|
|
134
138
|
exist: boolean,
|
|
135
139
|
};
|
|
136
140
|
"open-siyuan-url-plugin": {
|
|
137
|
-
url: string
|
|
138
|
-
}
|
|
141
|
+
url: string,
|
|
142
|
+
};
|
|
139
143
|
"ws-main": IWebSocketData;
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
interface IPosition {
|
|
143
|
-
x: number
|
|
144
|
-
y: number
|
|
145
|
-
w?: number
|
|
146
|
-
h?: number
|
|
147
|
-
isLeft?: boolean
|
|
146
|
+
export interface IPosition {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
w?: number;
|
|
150
|
+
h?: number;
|
|
151
|
+
isLeft?: boolean;
|
|
148
152
|
}
|
|
149
153
|
|
|
150
|
-
interface ITab {
|
|
154
|
+
export interface ITab {
|
|
151
155
|
id: string;
|
|
152
156
|
headElement: HTMLElement;
|
|
153
157
|
panelElement: HTMLElement;
|
|
@@ -162,7 +166,7 @@ interface ITab {
|
|
|
162
166
|
close: () => void;
|
|
163
167
|
}
|
|
164
168
|
|
|
165
|
-
interface IModel {
|
|
169
|
+
export interface IModel {
|
|
166
170
|
ws: WebSocket;
|
|
167
171
|
app: App;
|
|
168
172
|
reqId: number;
|
|
@@ -171,7 +175,7 @@ interface IModel {
|
|
|
171
175
|
send(cmd: string, param: Record<string, unknown>, process?: boolean): void;
|
|
172
176
|
}
|
|
173
177
|
|
|
174
|
-
interface ICustomModel extends IModel {
|
|
178
|
+
export interface ICustomModel extends IModel {
|
|
175
179
|
tab: ITab;
|
|
176
180
|
data: any;
|
|
177
181
|
type: string;
|
|
@@ -188,21 +192,21 @@ interface ICustomModel extends IModel {
|
|
|
188
192
|
destroy?(): void;
|
|
189
193
|
}
|
|
190
194
|
|
|
191
|
-
interface IDockModel extends Omit<ICustomModel, "beforeDestroy"> {
|
|
195
|
+
export interface IDockModel extends Omit<ICustomModel, "beforeDestroy"> {
|
|
192
196
|
}
|
|
193
197
|
|
|
194
|
-
interface ITabModel extends ICustomModel {
|
|
198
|
+
export interface ITabModel extends ICustomModel {
|
|
195
199
|
}
|
|
196
200
|
|
|
197
|
-
interface IObject {
|
|
201
|
+
export interface IObject {
|
|
198
202
|
[key: string]: string;
|
|
199
203
|
}
|
|
200
204
|
|
|
201
|
-
interface I18N {
|
|
205
|
+
export interface I18N {
|
|
202
206
|
[key: string]: any;
|
|
203
207
|
}
|
|
204
208
|
|
|
205
|
-
interface ILuteNode {
|
|
209
|
+
export interface ILuteNode {
|
|
206
210
|
TokensStr: () => string;
|
|
207
211
|
__internal_object__: {
|
|
208
212
|
Parent: {
|
|
@@ -212,75 +216,78 @@ interface ILuteNode {
|
|
|
212
216
|
};
|
|
213
217
|
}
|
|
214
218
|
|
|
215
|
-
interface ISearchOption {
|
|
216
|
-
page?: number
|
|
217
|
-
removed?: boolean // 移除后需记录搜索内容 https://github.com/siyuan-note/siyuan/issues/7745
|
|
218
|
-
name?: string
|
|
219
|
-
sort?: number
|
|
220
|
-
group?: number
|
|
221
|
-
hasReplace?: boolean
|
|
222
|
-
method?: number // 0:文本,1:查询语法,2:SQL,3:正则表达式
|
|
223
|
-
hPath?: string
|
|
224
|
-
idPath?: string[]
|
|
225
|
-
k: string
|
|
226
|
-
r?: string
|
|
219
|
+
export interface ISearchOption {
|
|
220
|
+
page?: number;
|
|
221
|
+
removed?: boolean; // 移除后需记录搜索内容 https://github.com/siyuan-note/siyuan/issues/7745
|
|
222
|
+
name?: string;
|
|
223
|
+
sort?: number; // 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序
|
|
224
|
+
group?: number; // 0:不分组,1:按文档分组
|
|
225
|
+
hasReplace?: boolean;
|
|
226
|
+
method?: number; // 0:文本,1:查询语法,2:SQL,3:正则表达式
|
|
227
|
+
hPath?: string;
|
|
228
|
+
idPath?: string[];
|
|
229
|
+
k: string;
|
|
230
|
+
r?: string;
|
|
227
231
|
types?: {
|
|
228
|
-
mathBlock: boolean
|
|
229
|
-
table: boolean
|
|
230
|
-
blockquote: boolean
|
|
231
|
-
superBlock: boolean
|
|
232
|
-
paragraph: boolean
|
|
233
|
-
document: boolean
|
|
234
|
-
heading: boolean
|
|
235
|
-
list: boolean
|
|
236
|
-
listItem: boolean
|
|
237
|
-
codeBlock: boolean
|
|
238
|
-
htmlBlock: boolean
|
|
239
|
-
embedBlock: boolean
|
|
240
|
-
databaseBlock: boolean
|
|
241
|
-
}
|
|
232
|
+
mathBlock: boolean,
|
|
233
|
+
table: boolean,
|
|
234
|
+
blockquote: boolean,
|
|
235
|
+
superBlock: boolean,
|
|
236
|
+
paragraph: boolean,
|
|
237
|
+
document: boolean,
|
|
238
|
+
heading: boolean,
|
|
239
|
+
list: boolean,
|
|
240
|
+
listItem: boolean,
|
|
241
|
+
codeBlock: boolean,
|
|
242
|
+
htmlBlock: boolean,
|
|
243
|
+
embedBlock: boolean,
|
|
244
|
+
databaseBlock: boolean,
|
|
245
|
+
};
|
|
242
246
|
}
|
|
243
247
|
|
|
244
|
-
interface IWebSocketData {
|
|
245
|
-
cmd: string
|
|
246
|
-
callback?: string
|
|
247
|
-
data: any
|
|
248
|
-
msg: string
|
|
249
|
-
code: number
|
|
250
|
-
sid: string
|
|
248
|
+
export interface IWebSocketData {
|
|
249
|
+
cmd: string;
|
|
250
|
+
callback?: string;
|
|
251
|
+
data: any;
|
|
252
|
+
msg: string;
|
|
253
|
+
code: number;
|
|
254
|
+
sid: string;
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
interface IPluginDockTab {
|
|
254
|
-
position: "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight"
|
|
255
|
-
size: {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
export interface IPluginDockTab {
|
|
258
|
+
position: "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight";
|
|
259
|
+
size: {
|
|
260
|
+
width: number,
|
|
261
|
+
height: number,
|
|
262
|
+
};
|
|
263
|
+
icon: string;
|
|
264
|
+
hotkey?: string;
|
|
265
|
+
title: string;
|
|
266
|
+
index?: number;
|
|
267
|
+
show?: boolean;
|
|
261
268
|
}
|
|
262
269
|
|
|
263
|
-
interface IMenuItemOption {
|
|
264
|
-
iconClass?: string
|
|
265
|
-
label?: string
|
|
266
|
-
click?: (element: HTMLElement, event: MouseEvent) => boolean | void | Promise<boolean | void
|
|
267
|
-
type?: "separator" | "submenu" | "readonly"
|
|
268
|
-
accelerator?: string
|
|
269
|
-
action?: string
|
|
270
|
-
id?: string
|
|
271
|
-
submenu?: IMenuItemOption[]
|
|
272
|
-
disabled?: boolean
|
|
273
|
-
icon?: string
|
|
274
|
-
iconHTML?: string
|
|
275
|
-
current?: boolean
|
|
276
|
-
bind?: (element: HTMLElement) => void
|
|
277
|
-
index?: number
|
|
278
|
-
element?: HTMLElement
|
|
270
|
+
export interface IMenuItemOption {
|
|
271
|
+
iconClass?: string;
|
|
272
|
+
label?: string;
|
|
273
|
+
click?: (element: HTMLElement, event: MouseEvent) => boolean | void | Promise<boolean | void>;
|
|
274
|
+
type?: "separator" | "submenu" | "readonly";
|
|
275
|
+
accelerator?: string;
|
|
276
|
+
action?: string;
|
|
277
|
+
id?: string;
|
|
278
|
+
submenu?: IMenuItemOption[];
|
|
279
|
+
disabled?: boolean;
|
|
280
|
+
icon?: string;
|
|
281
|
+
iconHTML?: string;
|
|
282
|
+
current?: boolean;
|
|
283
|
+
bind?: (element: HTMLElement) => void;
|
|
284
|
+
index?: number;
|
|
285
|
+
element?: HTMLElement;
|
|
279
286
|
}
|
|
280
287
|
|
|
281
|
-
interface ICommandOption {
|
|
282
|
-
langKey: string
|
|
283
|
-
langText?: string
|
|
288
|
+
export interface ICommandOption {
|
|
289
|
+
langKey: string // 用于区分不同快捷键的 key
|
|
290
|
+
langText?: string // 快捷键功能描述文本
|
|
284
291
|
/**
|
|
285
292
|
* 目前需使用 MacOS 符号标识,顺序按照 ⌥⇧⌘,入 ⌥⇧⌘A
|
|
286
293
|
* "Ctrl": "⌘",
|
|
@@ -293,59 +300,59 @@ interface ICommandOption {
|
|
|
293
300
|
*/
|
|
294
301
|
hotkey: string,
|
|
295
302
|
customHotkey?: string,
|
|
296
|
-
callback?: () => void
|
|
303
|
+
callback?: () => void // 其余回调存在时将不会触
|
|
297
304
|
globalCallback?: () => void // 焦点不在应用内时执行的回调
|
|
298
305
|
fileTreeCallback?: (file: any) => void // 焦点在文档树上时执行的回调
|
|
299
|
-
editorCallback?: (protyle: any) => void
|
|
300
|
-
dockCallback?: (element: HTMLElement) => void
|
|
306
|
+
editorCallback?: (protyle: any) => void // 焦点在编辑器上时执行的回调
|
|
307
|
+
dockCallback?: (element: HTMLElement) => void // 焦点在 dock 上时执行的回调
|
|
301
308
|
}
|
|
302
309
|
|
|
303
|
-
interface IProtyleOption {
|
|
304
|
-
action?: TProtyleAction[]
|
|
305
|
-
mode?: "preview" | "wysiwyg"
|
|
306
|
-
blockId: string
|
|
307
|
-
key?: string
|
|
310
|
+
export interface IProtyleOption {
|
|
311
|
+
action?: TProtyleAction[];
|
|
312
|
+
mode?: "preview" | "wysiwyg";
|
|
313
|
+
blockId: string;
|
|
314
|
+
key?: string;
|
|
308
315
|
scrollAttr?: {
|
|
309
316
|
rootId: string,
|
|
310
317
|
startId: string,
|
|
311
|
-
endId: string
|
|
318
|
+
endId: string,
|
|
312
319
|
scrollTop: number,
|
|
313
320
|
focusId?: string,
|
|
314
|
-
focusStart?: number
|
|
315
|
-
focusEnd?: number
|
|
316
|
-
zoomInId?: string
|
|
317
|
-
}
|
|
318
|
-
defId?: string
|
|
321
|
+
focusStart?: number,
|
|
322
|
+
focusEnd?: number,
|
|
323
|
+
zoomInId?: string,
|
|
324
|
+
};
|
|
325
|
+
defId?: string;
|
|
319
326
|
render?: {
|
|
320
|
-
background?: boolean
|
|
321
|
-
title?: boolean
|
|
322
|
-
gutter?: boolean
|
|
323
|
-
scroll?: boolean
|
|
324
|
-
breadcrumb?: boolean
|
|
325
|
-
breadcrumbDocName?: boolean
|
|
326
|
-
}
|
|
327
|
+
background?: boolean,
|
|
328
|
+
title?: boolean,
|
|
329
|
+
gutter?: boolean,
|
|
330
|
+
scroll?: boolean,
|
|
331
|
+
breadcrumb?: boolean,
|
|
332
|
+
breadcrumbDocName?: boolean,
|
|
333
|
+
};
|
|
327
334
|
typewriterMode?: boolean;
|
|
328
335
|
|
|
329
336
|
after?(protyle: Protyle): void;
|
|
330
337
|
}
|
|
331
338
|
|
|
332
|
-
interface IOperation {
|
|
333
|
-
action: TOperation
|
|
334
|
-
id?: string
|
|
335
|
-
avID?: string
|
|
336
|
-
format?: string // updateAttrViewColNumberFormat 专享
|
|
337
|
-
keyID?: string // updateAttrViewCell 专享
|
|
338
|
-
rowID?: string // updateAttrViewCell 专享
|
|
339
|
-
data?: any
|
|
340
|
-
parentID?: string
|
|
341
|
-
previousID?: string
|
|
342
|
-
retData?: any
|
|
343
|
-
nextID?: string // insert 专享
|
|
344
|
-
srcIDs?: string[] // insertAttrViewBlock 专享
|
|
345
|
-
name?: string // addAttrViewCol 专享
|
|
346
|
-
type?: TAVCol // addAttrViewCol 专享
|
|
347
|
-
deckID?: string // add/removeFlashcards 专享
|
|
348
|
-
blockIDs?: string[] // add/removeFlashcards 专享
|
|
339
|
+
export interface IOperation {
|
|
340
|
+
action: TOperation; // move, delete 不需要传 data
|
|
341
|
+
id?: string;
|
|
342
|
+
avID?: string; // av
|
|
343
|
+
format?: string; // updateAttrViewColNumberFormat 专享
|
|
344
|
+
keyID?: string; // updateAttrViewCell 专享
|
|
345
|
+
rowID?: string; // updateAttrViewCell 专享
|
|
346
|
+
data?: any; // updateAttr 时为 { old: IObject, new: IObject }, updateAttrViewCell 时为 {TAVCol: {content: string}}
|
|
347
|
+
parentID?: string;
|
|
348
|
+
previousID?: string;
|
|
349
|
+
retData?: any;
|
|
350
|
+
nextID?: string; // insert 专享
|
|
351
|
+
srcIDs?: string[]; // insertAttrViewBlock 专享
|
|
352
|
+
name?: string; // addAttrViewCol 专享
|
|
353
|
+
type?: TAVCol; // addAttrViewCol 专享
|
|
354
|
+
deckID?: string; // add/removeFlashcards 专享
|
|
355
|
+
blockIDs?: string[]; // add/removeFlashcards 专享
|
|
349
356
|
}
|
|
350
357
|
|
|
351
358
|
export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
|
|
@@ -363,46 +370,46 @@ export function openWindow(options: {
|
|
|
363
370
|
width?: number,
|
|
364
371
|
tab?: ITab,
|
|
365
372
|
doc?: {
|
|
366
|
-
id: string
|
|
373
|
+
id: string; // 块 id
|
|
367
374
|
},
|
|
368
375
|
}): void;
|
|
369
376
|
|
|
370
377
|
export function openTab(options: {
|
|
371
378
|
app: App,
|
|
372
379
|
doc?: {
|
|
373
|
-
id: string,
|
|
374
|
-
action?: string[] // cb-get-all:获取所有内容;cb-get-focus:打开后光标定位在 id 所在的块;cb-get-hl: 打开后 id 块高亮
|
|
375
|
-
zoomIn?: boolean // 是否缩放
|
|
376
|
-
}
|
|
380
|
+
id: string, // 块 id
|
|
381
|
+
action?: string[], // cb-get-all:获取所有内容;cb-get-focus:打开后光标定位在 id 所在的块;cb-get-hl: 打开后 id 块高亮
|
|
382
|
+
zoomIn?: boolean, // 是否缩放
|
|
383
|
+
};
|
|
377
384
|
pdf?: {
|
|
378
385
|
path: string,
|
|
379
386
|
page?: number, // pdf 页码
|
|
380
387
|
id?: string, // File Annotation id
|
|
381
|
-
}
|
|
388
|
+
};
|
|
382
389
|
asset?: {
|
|
383
390
|
path: string,
|
|
384
|
-
}
|
|
385
|
-
search?: ISearchOption
|
|
391
|
+
};
|
|
392
|
+
search?: ISearchOption;
|
|
386
393
|
card?: {
|
|
387
394
|
type: TCardType,
|
|
388
395
|
id?: string, // cardType 为 all 时不传,否则传文档或笔记本 id
|
|
389
|
-
title?: string // cardType 为 all 时不传,否则传文档或笔记本名称
|
|
390
|
-
}
|
|
396
|
+
title?: string, // cardType 为 all 时不传,否则传文档或笔记本名称
|
|
397
|
+
};
|
|
391
398
|
custom?: {
|
|
392
|
-
title: string,
|
|
393
|
-
icon: string,
|
|
394
|
-
data?: any
|
|
395
399
|
id: string, // 插件名称+页签类型:plugin.name + tab.type
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
400
|
+
icon: string,
|
|
401
|
+
title: string,
|
|
402
|
+
data?: any,
|
|
403
|
+
};
|
|
404
|
+
position?: "right" | "bottom";
|
|
405
|
+
keepCursor?: boolean; // 是否跳转到新 tab 上
|
|
406
|
+
removeCurrentTab?: boolean; // 在当前页签打开时需移除原有页签
|
|
407
|
+
afterOpen?: () => void; // 打开后回调
|
|
401
408
|
}): ITab
|
|
402
409
|
|
|
403
410
|
export function getFrontend(): "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile";
|
|
404
411
|
|
|
405
|
-
export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios"
|
|
412
|
+
export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios";
|
|
406
413
|
|
|
407
414
|
export function adaptHotkey(hotkey: string): string;
|
|
408
415
|
|
|
@@ -430,15 +437,15 @@ export abstract class Plugin {
|
|
|
430
437
|
protyleSlash: {
|
|
431
438
|
filter: string[],
|
|
432
439
|
html: string,
|
|
433
|
-
id: string
|
|
434
|
-
callback(protyle: Protyle): void
|
|
440
|
+
id: string,
|
|
441
|
+
callback(protyle: Protyle): void,
|
|
435
442
|
}[];
|
|
436
443
|
|
|
437
444
|
constructor(options: {
|
|
438
445
|
app: App,
|
|
439
446
|
name: string,
|
|
440
|
-
i18n: I18N
|
|
441
|
-
})
|
|
447
|
+
i18n: I18N,
|
|
448
|
+
});
|
|
442
449
|
|
|
443
450
|
onload(): void;
|
|
444
451
|
|
|
@@ -464,10 +471,10 @@ export abstract class Plugin {
|
|
|
464
471
|
*/
|
|
465
472
|
addStatusBar(options: {
|
|
466
473
|
element: HTMLElement,
|
|
467
|
-
position?: "right" | "left"
|
|
468
|
-
}): HTMLElement
|
|
474
|
+
position?: "right" | "left",
|
|
475
|
+
}): HTMLElement;
|
|
469
476
|
|
|
470
|
-
openSetting(): void
|
|
477
|
+
openSetting(): void;
|
|
471
478
|
|
|
472
479
|
loadData(storageName: string): Promise<any>;
|
|
473
480
|
|
|
@@ -488,8 +495,8 @@ export abstract class Plugin {
|
|
|
488
495
|
destroy?: (this: ITabModel) => void,
|
|
489
496
|
resize?: (this: ITabModel) => void,
|
|
490
497
|
update?: (this: ITabModel) => void,
|
|
491
|
-
init: (this: ITabModel) => void
|
|
492
|
-
}): () => ITabModel
|
|
498
|
+
init: (this: ITabModel) => void,
|
|
499
|
+
}): () => ITabModel;
|
|
493
500
|
|
|
494
501
|
/**
|
|
495
502
|
* Must be executed before the synchronous function.
|
|
@@ -501,10 +508,10 @@ export abstract class Plugin {
|
|
|
501
508
|
destroy?: (this: IDockModel) => void,
|
|
502
509
|
resize?: (this: IDockModel) => void,
|
|
503
510
|
update?: (this: IDockModel) => void,
|
|
504
|
-
init: (this: IDockModel) => void
|
|
505
|
-
}): { config: IPluginDockTab, model: IDockModel }
|
|
511
|
+
init: (this: IDockModel) => void,
|
|
512
|
+
}): { config: IPluginDockTab, model: IDockModel };
|
|
506
513
|
|
|
507
|
-
addCommand(options: ICommandOption): void
|
|
514
|
+
addCommand(options: ICommandOption): void;
|
|
508
515
|
|
|
509
516
|
addFloatLayer(options: {
|
|
510
517
|
ids: string[],
|
|
@@ -512,22 +519,22 @@ export abstract class Plugin {
|
|
|
512
519
|
x?: number,
|
|
513
520
|
y?: number,
|
|
514
521
|
targetElement?: HTMLElement
|
|
515
|
-
}): void
|
|
522
|
+
}): void;
|
|
516
523
|
}
|
|
517
524
|
|
|
518
525
|
export class Setting {
|
|
519
526
|
constructor(options: {
|
|
520
527
|
height?: string,
|
|
521
528
|
width?: string,
|
|
522
|
-
destroyCallback?: () => void
|
|
523
|
-
confirmCallback?: () => void
|
|
524
|
-
})
|
|
529
|
+
destroyCallback?: () => void,
|
|
530
|
+
confirmCallback?: () => void,
|
|
531
|
+
});
|
|
525
532
|
|
|
526
533
|
addItem(options: {
|
|
527
|
-
title: string
|
|
528
|
-
description?: string
|
|
529
|
-
actionElement?: HTMLElement
|
|
530
|
-
createActionElement?(): HTMLElement
|
|
534
|
+
title: string,
|
|
535
|
+
description?: string,
|
|
536
|
+
actionElement?: HTMLElement,
|
|
537
|
+
createActionElement?(): HTMLElement,
|
|
531
538
|
}): void;
|
|
532
539
|
|
|
533
540
|
open(name: string): void;
|
|
@@ -565,9 +572,9 @@ export class Dialog {
|
|
|
565
572
|
content: string,
|
|
566
573
|
width?: string
|
|
567
574
|
height?: string,
|
|
568
|
-
destroyCallback?: (options?: IObject) => void
|
|
569
|
-
disableClose?: boolean
|
|
570
|
-
disableAnimation?: boolean
|
|
575
|
+
destroyCallback?: (options?: IObject) => void,
|
|
576
|
+
disableClose?: boolean,
|
|
577
|
+
disableAnimation?: boolean,
|
|
571
578
|
});
|
|
572
579
|
|
|
573
580
|
destroy(options?: IObject): void;
|
|
@@ -599,9 +606,9 @@ export class Menu {
|
|
|
599
606
|
export class EventMenu {
|
|
600
607
|
public menus: IMenuItemOption[];
|
|
601
608
|
|
|
602
|
-
constructor()
|
|
609
|
+
constructor();
|
|
603
610
|
|
|
604
|
-
public addSeparator(index?: number): void
|
|
611
|
+
public addSeparator(index?: number): void;
|
|
605
612
|
|
|
606
|
-
public addItem(menu: IMenuItemOption): void
|
|
613
|
+
public addItem(menu: IMenuItemOption): void;
|
|
607
614
|
}
|
package/types/events.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {IProtyle} from "./protyle";
|
|
2
2
|
import {EventMenu} from "./../siyuan";
|
|
3
3
|
|
|
4
|
-
interface IMenuBaseDetail {
|
|
5
|
-
menu: EventMenu
|
|
6
|
-
protyle: IProtyle
|
|
7
|
-
element: HTMLElement
|
|
4
|
+
export interface IMenuBaseDetail {
|
|
5
|
+
menu: EventMenu;
|
|
6
|
+
protyle: IProtyle;
|
|
7
|
+
element: HTMLElement;
|
|
8
8
|
}
|
package/types/index.d.ts
ADDED
package/types/response.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {IObject} from "../siyuan";
|
|
2
2
|
|
|
3
|
-
interface IGetDocInfo {
|
|
4
|
-
ial: IObject
|
|
5
|
-
icon:
|
|
6
|
-
id:
|
|
7
|
-
name:
|
|
8
|
-
refCount: number
|
|
9
|
-
refIDs: string[]
|
|
10
|
-
rootID: string
|
|
11
|
-
subFileCount: number
|
|
3
|
+
export interface IGetDocInfo {
|
|
4
|
+
ial: IObject;
|
|
5
|
+
icon: string;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
refCount: number;
|
|
9
|
+
refIDs: string[];
|
|
10
|
+
rootID: string;
|
|
11
|
+
subFileCount: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
interface IGetTreeStat {
|
|
14
|
+
export interface IGetTreeStat {
|
|
15
15
|
imageCount: number;
|
|
16
16
|
linkCount: number;
|
|
17
17
|
refCount: number;
|