siyuan 0.8.5 → 0.8.7
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 +11 -1
- package/package.json +1 -1
- package/siyuan.d.ts +195 -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
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.8.
|
|
3
|
+
## 0.8.8 2023-10
|
|
4
|
+
|
|
5
|
+
## 0.8.7 2023-10-24
|
|
6
|
+
|
|
7
|
+
* [Deprecated `loaded-protyle` use `loaded-protyle-static` instead](https://github.com/siyuan-note/siyuan/issues/9468)
|
|
8
|
+
* [Fix event defail for `loaded-protyle`](https://github.com/siyuan-note/petal/pull/18)
|
|
9
|
+
* [Add plugin event bus `paste`](https://github.com/siyuan-note/siyuan/issues/9452)
|
|
10
|
+
|
|
11
|
+
## 0.8.6 2023-10-17
|
|
12
|
+
|
|
13
|
+
* [Update some definitions](https://github.com/siyuan-note/petal/pull/17)
|
|
4
14
|
|
|
5
15
|
## 0.8.5 2023-10-10
|
|
6
16
|
|
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
|
-
"loaded-protyle": {
|
|
110
|
+
"loaded-protyle-static": {
|
|
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,28 @@ interface IEventBusMap {
|
|
|
134
138
|
exist: boolean,
|
|
135
139
|
};
|
|
136
140
|
"open-siyuan-url-plugin": {
|
|
137
|
-
url: string
|
|
141
|
+
url: string,
|
|
142
|
+
};
|
|
143
|
+
"paste": {
|
|
144
|
+
protyle: IProtyle,
|
|
145
|
+
resolve: new <T>(value: T | PromiseLike<T>) => void,
|
|
146
|
+
textHTML: string,
|
|
147
|
+
textPlain: string,
|
|
148
|
+
siyuanHTML: string,
|
|
149
|
+
files: FileList | DataTransferItemList;
|
|
138
150
|
}
|
|
139
151
|
"ws-main": IWebSocketData;
|
|
140
152
|
}
|
|
141
153
|
|
|
142
|
-
interface IPosition {
|
|
143
|
-
x: number
|
|
144
|
-
y: number
|
|
145
|
-
w?: number
|
|
146
|
-
h?: number
|
|
147
|
-
isLeft?: boolean
|
|
154
|
+
export interface IPosition {
|
|
155
|
+
x: number;
|
|
156
|
+
y: number;
|
|
157
|
+
w?: number;
|
|
158
|
+
h?: number;
|
|
159
|
+
isLeft?: boolean;
|
|
148
160
|
}
|
|
149
161
|
|
|
150
|
-
interface ITab {
|
|
162
|
+
export interface ITab {
|
|
151
163
|
id: string;
|
|
152
164
|
headElement: HTMLElement;
|
|
153
165
|
panelElement: HTMLElement;
|
|
@@ -162,7 +174,7 @@ interface ITab {
|
|
|
162
174
|
close: () => void;
|
|
163
175
|
}
|
|
164
176
|
|
|
165
|
-
interface IModel {
|
|
177
|
+
export interface IModel {
|
|
166
178
|
ws: WebSocket;
|
|
167
179
|
app: App;
|
|
168
180
|
reqId: number;
|
|
@@ -171,7 +183,7 @@ interface IModel {
|
|
|
171
183
|
send(cmd: string, param: Record<string, unknown>, process?: boolean): void;
|
|
172
184
|
}
|
|
173
185
|
|
|
174
|
-
interface ICustomModel extends IModel {
|
|
186
|
+
export interface ICustomModel extends IModel {
|
|
175
187
|
tab: ITab;
|
|
176
188
|
data: any;
|
|
177
189
|
type: string;
|
|
@@ -188,21 +200,21 @@ interface ICustomModel extends IModel {
|
|
|
188
200
|
destroy?(): void;
|
|
189
201
|
}
|
|
190
202
|
|
|
191
|
-
interface IDockModel extends Omit<ICustomModel, "beforeDestroy"> {
|
|
203
|
+
export interface IDockModel extends Omit<ICustomModel, "beforeDestroy"> {
|
|
192
204
|
}
|
|
193
205
|
|
|
194
|
-
interface ITabModel extends ICustomModel {
|
|
206
|
+
export interface ITabModel extends ICustomModel {
|
|
195
207
|
}
|
|
196
208
|
|
|
197
|
-
interface IObject {
|
|
209
|
+
export interface IObject {
|
|
198
210
|
[key: string]: string;
|
|
199
211
|
}
|
|
200
212
|
|
|
201
|
-
interface I18N {
|
|
213
|
+
export interface I18N {
|
|
202
214
|
[key: string]: any;
|
|
203
215
|
}
|
|
204
216
|
|
|
205
|
-
interface ILuteNode {
|
|
217
|
+
export interface ILuteNode {
|
|
206
218
|
TokensStr: () => string;
|
|
207
219
|
__internal_object__: {
|
|
208
220
|
Parent: {
|
|
@@ -212,75 +224,78 @@ interface ILuteNode {
|
|
|
212
224
|
};
|
|
213
225
|
}
|
|
214
226
|
|
|
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
|
|
227
|
+
export interface ISearchOption {
|
|
228
|
+
page?: number;
|
|
229
|
+
removed?: boolean; // 移除后需记录搜索内容 https://github.com/siyuan-note/siyuan/issues/7745
|
|
230
|
+
name?: string;
|
|
231
|
+
sort?: number; // 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序
|
|
232
|
+
group?: number; // 0:不分组,1:按文档分组
|
|
233
|
+
hasReplace?: boolean;
|
|
234
|
+
method?: number; // 0:文本,1:查询语法,2:SQL,3:正则表达式
|
|
235
|
+
hPath?: string;
|
|
236
|
+
idPath?: string[];
|
|
237
|
+
k: string;
|
|
238
|
+
r?: string;
|
|
227
239
|
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
|
-
}
|
|
240
|
+
mathBlock: boolean,
|
|
241
|
+
table: boolean,
|
|
242
|
+
blockquote: boolean,
|
|
243
|
+
superBlock: boolean,
|
|
244
|
+
paragraph: boolean,
|
|
245
|
+
document: boolean,
|
|
246
|
+
heading: boolean,
|
|
247
|
+
list: boolean,
|
|
248
|
+
listItem: boolean,
|
|
249
|
+
codeBlock: boolean,
|
|
250
|
+
htmlBlock: boolean,
|
|
251
|
+
embedBlock: boolean,
|
|
252
|
+
databaseBlock: boolean,
|
|
253
|
+
};
|
|
242
254
|
}
|
|
243
255
|
|
|
244
|
-
interface IWebSocketData {
|
|
245
|
-
cmd: string
|
|
246
|
-
callback?: string
|
|
247
|
-
data: any
|
|
248
|
-
msg: string
|
|
249
|
-
code: number
|
|
250
|
-
sid: string
|
|
256
|
+
export interface IWebSocketData {
|
|
257
|
+
cmd: string;
|
|
258
|
+
callback?: string;
|
|
259
|
+
data: any;
|
|
260
|
+
msg: string;
|
|
261
|
+
code: number;
|
|
262
|
+
sid: string;
|
|
251
263
|
}
|
|
252
264
|
|
|
253
|
-
interface IPluginDockTab {
|
|
254
|
-
position: "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight"
|
|
255
|
-
size: {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
265
|
+
export interface IPluginDockTab {
|
|
266
|
+
position: "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight";
|
|
267
|
+
size: {
|
|
268
|
+
width: number,
|
|
269
|
+
height: number,
|
|
270
|
+
};
|
|
271
|
+
icon: string;
|
|
272
|
+
hotkey?: string;
|
|
273
|
+
title: string;
|
|
274
|
+
index?: number;
|
|
275
|
+
show?: boolean;
|
|
261
276
|
}
|
|
262
277
|
|
|
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
|
|
278
|
+
export interface IMenuItemOption {
|
|
279
|
+
iconClass?: string;
|
|
280
|
+
label?: string;
|
|
281
|
+
click?: (element: HTMLElement, event: MouseEvent) => boolean | void | Promise<boolean | void>;
|
|
282
|
+
type?: "separator" | "submenu" | "readonly";
|
|
283
|
+
accelerator?: string;
|
|
284
|
+
action?: string;
|
|
285
|
+
id?: string;
|
|
286
|
+
submenu?: IMenuItemOption[];
|
|
287
|
+
disabled?: boolean;
|
|
288
|
+
icon?: string;
|
|
289
|
+
iconHTML?: string;
|
|
290
|
+
current?: boolean;
|
|
291
|
+
bind?: (element: HTMLElement) => void;
|
|
292
|
+
index?: number;
|
|
293
|
+
element?: HTMLElement;
|
|
279
294
|
}
|
|
280
295
|
|
|
281
|
-
interface ICommandOption {
|
|
282
|
-
langKey: string
|
|
283
|
-
langText?: string
|
|
296
|
+
export interface ICommandOption {
|
|
297
|
+
langKey: string // 用于区分不同快捷键的 key
|
|
298
|
+
langText?: string // 快捷键功能描述文本
|
|
284
299
|
/**
|
|
285
300
|
* 目前需使用 MacOS 符号标识,顺序按照 ⌥⇧⌘,入 ⌥⇧⌘A
|
|
286
301
|
* "Ctrl": "⌘",
|
|
@@ -293,59 +308,59 @@ interface ICommandOption {
|
|
|
293
308
|
*/
|
|
294
309
|
hotkey: string,
|
|
295
310
|
customHotkey?: string,
|
|
296
|
-
callback?: () => void
|
|
311
|
+
callback?: () => void // 其余回调存在时将不会触
|
|
297
312
|
globalCallback?: () => void // 焦点不在应用内时执行的回调
|
|
298
313
|
fileTreeCallback?: (file: any) => void // 焦点在文档树上时执行的回调
|
|
299
|
-
editorCallback?: (protyle: any) => void
|
|
300
|
-
dockCallback?: (element: HTMLElement) => void
|
|
314
|
+
editorCallback?: (protyle: any) => void // 焦点在编辑器上时执行的回调
|
|
315
|
+
dockCallback?: (element: HTMLElement) => void // 焦点在 dock 上时执行的回调
|
|
301
316
|
}
|
|
302
317
|
|
|
303
|
-
interface IProtyleOption {
|
|
304
|
-
action?: TProtyleAction[]
|
|
305
|
-
mode?: "preview" | "wysiwyg"
|
|
306
|
-
blockId: string
|
|
307
|
-
key?: string
|
|
318
|
+
export interface IProtyleOption {
|
|
319
|
+
action?: TProtyleAction[];
|
|
320
|
+
mode?: "preview" | "wysiwyg";
|
|
321
|
+
blockId: string;
|
|
322
|
+
key?: string;
|
|
308
323
|
scrollAttr?: {
|
|
309
324
|
rootId: string,
|
|
310
325
|
startId: string,
|
|
311
|
-
endId: string
|
|
326
|
+
endId: string,
|
|
312
327
|
scrollTop: number,
|
|
313
328
|
focusId?: string,
|
|
314
|
-
focusStart?: number
|
|
315
|
-
focusEnd?: number
|
|
316
|
-
zoomInId?: string
|
|
317
|
-
}
|
|
318
|
-
defId?: string
|
|
329
|
+
focusStart?: number,
|
|
330
|
+
focusEnd?: number,
|
|
331
|
+
zoomInId?: string,
|
|
332
|
+
};
|
|
333
|
+
defId?: string;
|
|
319
334
|
render?: {
|
|
320
|
-
background?: boolean
|
|
321
|
-
title?: boolean
|
|
322
|
-
gutter?: boolean
|
|
323
|
-
scroll?: boolean
|
|
324
|
-
breadcrumb?: boolean
|
|
325
|
-
breadcrumbDocName?: boolean
|
|
326
|
-
}
|
|
335
|
+
background?: boolean,
|
|
336
|
+
title?: boolean,
|
|
337
|
+
gutter?: boolean,
|
|
338
|
+
scroll?: boolean,
|
|
339
|
+
breadcrumb?: boolean,
|
|
340
|
+
breadcrumbDocName?: boolean,
|
|
341
|
+
};
|
|
327
342
|
typewriterMode?: boolean;
|
|
328
343
|
|
|
329
344
|
after?(protyle: Protyle): void;
|
|
330
345
|
}
|
|
331
346
|
|
|
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 专享
|
|
347
|
+
export interface IOperation {
|
|
348
|
+
action: TOperation; // move, delete 不需要传 data
|
|
349
|
+
id?: string;
|
|
350
|
+
avID?: string; // av
|
|
351
|
+
format?: string; // updateAttrViewColNumberFormat 专享
|
|
352
|
+
keyID?: string; // updateAttrViewCell 专享
|
|
353
|
+
rowID?: string; // updateAttrViewCell 专享
|
|
354
|
+
data?: any; // updateAttr 时为 { old: IObject, new: IObject }, updateAttrViewCell 时为 {TAVCol: {content: string}}
|
|
355
|
+
parentID?: string;
|
|
356
|
+
previousID?: string;
|
|
357
|
+
retData?: any;
|
|
358
|
+
nextID?: string; // insert 专享
|
|
359
|
+
srcIDs?: string[]; // insertAttrViewBlock 专享
|
|
360
|
+
name?: string; // addAttrViewCol 专享
|
|
361
|
+
type?: TAVCol; // addAttrViewCol 专享
|
|
362
|
+
deckID?: string; // add/removeFlashcards 专享
|
|
363
|
+
blockIDs?: string[]; // add/removeFlashcards 专享
|
|
349
364
|
}
|
|
350
365
|
|
|
351
366
|
export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
|
|
@@ -363,46 +378,46 @@ export function openWindow(options: {
|
|
|
363
378
|
width?: number,
|
|
364
379
|
tab?: ITab,
|
|
365
380
|
doc?: {
|
|
366
|
-
id: string
|
|
381
|
+
id: string; // 块 id
|
|
367
382
|
},
|
|
368
383
|
}): void;
|
|
369
384
|
|
|
370
385
|
export function openTab(options: {
|
|
371
386
|
app: App,
|
|
372
387
|
doc?: {
|
|
373
|
-
id: string,
|
|
374
|
-
action?: string[] // cb-get-all:获取所有内容;cb-get-focus:打开后光标定位在 id 所在的块;cb-get-hl: 打开后 id 块高亮
|
|
375
|
-
zoomIn?: boolean // 是否缩放
|
|
376
|
-
}
|
|
388
|
+
id: string, // 块 id
|
|
389
|
+
action?: string[], // cb-get-all:获取所有内容;cb-get-focus:打开后光标定位在 id 所在的块;cb-get-hl: 打开后 id 块高亮
|
|
390
|
+
zoomIn?: boolean, // 是否缩放
|
|
391
|
+
};
|
|
377
392
|
pdf?: {
|
|
378
393
|
path: string,
|
|
379
394
|
page?: number, // pdf 页码
|
|
380
395
|
id?: string, // File Annotation id
|
|
381
|
-
}
|
|
396
|
+
};
|
|
382
397
|
asset?: {
|
|
383
398
|
path: string,
|
|
384
|
-
}
|
|
385
|
-
search?: ISearchOption
|
|
399
|
+
};
|
|
400
|
+
search?: ISearchOption;
|
|
386
401
|
card?: {
|
|
387
402
|
type: TCardType,
|
|
388
403
|
id?: string, // cardType 为 all 时不传,否则传文档或笔记本 id
|
|
389
|
-
title?: string // cardType 为 all 时不传,否则传文档或笔记本名称
|
|
390
|
-
}
|
|
404
|
+
title?: string, // cardType 为 all 时不传,否则传文档或笔记本名称
|
|
405
|
+
};
|
|
391
406
|
custom?: {
|
|
392
|
-
title: string,
|
|
393
|
-
icon: string,
|
|
394
|
-
data?: any
|
|
395
407
|
id: string, // 插件名称+页签类型:plugin.name + tab.type
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
408
|
+
icon: string,
|
|
409
|
+
title: string,
|
|
410
|
+
data?: any,
|
|
411
|
+
};
|
|
412
|
+
position?: "right" | "bottom";
|
|
413
|
+
keepCursor?: boolean; // 是否跳转到新 tab 上
|
|
414
|
+
removeCurrentTab?: boolean; // 在当前页签打开时需移除原有页签
|
|
415
|
+
afterOpen?: () => void; // 打开后回调
|
|
401
416
|
}): ITab
|
|
402
417
|
|
|
403
418
|
export function getFrontend(): "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile";
|
|
404
419
|
|
|
405
|
-
export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios"
|
|
420
|
+
export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios";
|
|
406
421
|
|
|
407
422
|
export function adaptHotkey(hotkey: string): string;
|
|
408
423
|
|
|
@@ -430,15 +445,15 @@ export abstract class Plugin {
|
|
|
430
445
|
protyleSlash: {
|
|
431
446
|
filter: string[],
|
|
432
447
|
html: string,
|
|
433
|
-
id: string
|
|
434
|
-
callback(protyle: Protyle): void
|
|
448
|
+
id: string,
|
|
449
|
+
callback(protyle: Protyle): void,
|
|
435
450
|
}[];
|
|
436
451
|
|
|
437
452
|
constructor(options: {
|
|
438
453
|
app: App,
|
|
439
454
|
name: string,
|
|
440
|
-
i18n: I18N
|
|
441
|
-
})
|
|
455
|
+
i18n: I18N,
|
|
456
|
+
});
|
|
442
457
|
|
|
443
458
|
onload(): void;
|
|
444
459
|
|
|
@@ -464,10 +479,10 @@ export abstract class Plugin {
|
|
|
464
479
|
*/
|
|
465
480
|
addStatusBar(options: {
|
|
466
481
|
element: HTMLElement,
|
|
467
|
-
position?: "right" | "left"
|
|
468
|
-
}): HTMLElement
|
|
482
|
+
position?: "right" | "left",
|
|
483
|
+
}): HTMLElement;
|
|
469
484
|
|
|
470
|
-
openSetting(): void
|
|
485
|
+
openSetting(): void;
|
|
471
486
|
|
|
472
487
|
loadData(storageName: string): Promise<any>;
|
|
473
488
|
|
|
@@ -488,8 +503,8 @@ export abstract class Plugin {
|
|
|
488
503
|
destroy?: (this: ITabModel) => void,
|
|
489
504
|
resize?: (this: ITabModel) => void,
|
|
490
505
|
update?: (this: ITabModel) => void,
|
|
491
|
-
init: (this: ITabModel) => void
|
|
492
|
-
}): () => ITabModel
|
|
506
|
+
init: (this: ITabModel) => void,
|
|
507
|
+
}): () => ITabModel;
|
|
493
508
|
|
|
494
509
|
/**
|
|
495
510
|
* Must be executed before the synchronous function.
|
|
@@ -501,10 +516,10 @@ export abstract class Plugin {
|
|
|
501
516
|
destroy?: (this: IDockModel) => void,
|
|
502
517
|
resize?: (this: IDockModel) => void,
|
|
503
518
|
update?: (this: IDockModel) => void,
|
|
504
|
-
init: (this: IDockModel) => void
|
|
505
|
-
}): { config: IPluginDockTab, model: IDockModel }
|
|
519
|
+
init: (this: IDockModel) => void,
|
|
520
|
+
}): { config: IPluginDockTab, model: IDockModel };
|
|
506
521
|
|
|
507
|
-
addCommand(options: ICommandOption): void
|
|
522
|
+
addCommand(options: ICommandOption): void;
|
|
508
523
|
|
|
509
524
|
addFloatLayer(options: {
|
|
510
525
|
ids: string[],
|
|
@@ -512,22 +527,22 @@ export abstract class Plugin {
|
|
|
512
527
|
x?: number,
|
|
513
528
|
y?: number,
|
|
514
529
|
targetElement?: HTMLElement
|
|
515
|
-
}): void
|
|
530
|
+
}): void;
|
|
516
531
|
}
|
|
517
532
|
|
|
518
533
|
export class Setting {
|
|
519
534
|
constructor(options: {
|
|
520
535
|
height?: string,
|
|
521
536
|
width?: string,
|
|
522
|
-
destroyCallback?: () => void
|
|
523
|
-
confirmCallback?: () => void
|
|
524
|
-
})
|
|
537
|
+
destroyCallback?: () => void,
|
|
538
|
+
confirmCallback?: () => void,
|
|
539
|
+
});
|
|
525
540
|
|
|
526
541
|
addItem(options: {
|
|
527
|
-
title: string
|
|
528
|
-
description?: string
|
|
529
|
-
actionElement?: HTMLElement
|
|
530
|
-
createActionElement?(): HTMLElement
|
|
542
|
+
title: string,
|
|
543
|
+
description?: string,
|
|
544
|
+
actionElement?: HTMLElement,
|
|
545
|
+
createActionElement?(): HTMLElement,
|
|
531
546
|
}): void;
|
|
532
547
|
|
|
533
548
|
open(name: string): void;
|
|
@@ -565,9 +580,9 @@ export class Dialog {
|
|
|
565
580
|
content: string,
|
|
566
581
|
width?: string
|
|
567
582
|
height?: string,
|
|
568
|
-
destroyCallback?: (options?: IObject) => void
|
|
569
|
-
disableClose?: boolean
|
|
570
|
-
disableAnimation?: boolean
|
|
583
|
+
destroyCallback?: (options?: IObject) => void,
|
|
584
|
+
disableClose?: boolean,
|
|
585
|
+
disableAnimation?: boolean,
|
|
571
586
|
});
|
|
572
587
|
|
|
573
588
|
destroy(options?: IObject): void;
|
|
@@ -599,9 +614,9 @@ export class Menu {
|
|
|
599
614
|
export class EventMenu {
|
|
600
615
|
public menus: IMenuItemOption[];
|
|
601
616
|
|
|
602
|
-
constructor()
|
|
617
|
+
constructor();
|
|
603
618
|
|
|
604
|
-
public addSeparator(index?: number): void
|
|
619
|
+
public addSeparator(index?: number): void;
|
|
605
620
|
|
|
606
|
-
public addItem(menu: IMenuItemOption): void
|
|
621
|
+
public addItem(menu: IMenuItemOption): void;
|
|
607
622
|
}
|
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;
|