siyuan 1.0.4 → 1.0.5
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 -2
- package/package.json +1 -1
- package/siyuan.d.ts +93 -284
- package/types/block/Panel.d.ts +27 -0
- package/types/config.d.ts +116 -15
- package/types/constants.ts +193 -40
- package/types/events.d.ts +2 -2
- package/types/index.d.ts +427 -0
- package/types/layout/Model.d.ts +23 -0
- package/types/layout/Tab.d.ts +36 -0
- package/types/layout/Wnd.d.ts +34 -0
- package/types/layout/dock/Files.d.ts +56 -0
- package/types/layout/dock/Inbox.d.ts +18 -0
- package/types/mobile/dock/MobileBacklinks.d.ts +10 -0
- package/types/mobile/dock/MobileBookmarks.d.ts +8 -0
- package/types/mobile/dock/MobileFiles.d.ts +31 -0
- package/types/mobile/dock/MobileOutline.d.ts +12 -0
- package/types/mobile/dock/MobileTags.d.ts +8 -0
- package/types/protyle/util/compatibility.d.ts +16 -0
- package/types/protyle.d.ts +430 -136
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v1.0.
|
|
3
|
+
## v1.0.6 2024-11
|
|
4
|
+
|
|
5
|
+
## v1.0.5 2024-11-05
|
|
6
|
+
|
|
7
|
+
* [Add `renderElement` and `blockElement` for `open-noneditableblock`](https://github.com/siyuan-note/siyuan/issues/12955)
|
|
8
|
+
* [Add plugin util `platformUtils`](https://github.com/siyuan-note/siyuan/issues/12930)
|
|
9
|
+
* [Added reading local files to `on-paste`](https://github.com/siyuan-note/siyuan/issues/12917)
|
|
10
|
+
* [Add plugin function `getAllEditor`](https://github.com/siyuan-note/siyuan/issues/12884)
|
|
11
|
+
* [Add plugin function `getModelByDockType`](https://github.com/siyuan-note/siyuan/issues/11782)
|
|
12
|
+
* [Replace `any` in IProtyle with the corresponding type](https://github.com/siyuan-note/petal/issues/34)
|
|
4
13
|
|
|
5
14
|
## v1.0.4 2024-10-15
|
|
6
15
|
|
|
7
|
-
* [Add plugin method `exitSiYuan`]https://github.com/siyuan-note/siyuan/pull/12767)
|
|
16
|
+
* [Add plugin method `exitSiYuan`](https://github.com/siyuan-note/siyuan/pull/12767)
|
|
8
17
|
|
|
9
18
|
## v1.0.3 2024-09-27
|
|
10
19
|
|
package/package.json
CHANGED
package/siyuan.d.ts
CHANGED
|
@@ -1,24 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
IGetDocInfo,
|
|
3
|
+
IGetTreeStat,
|
|
4
|
+
IMenuBaseDetail,
|
|
5
|
+
Config,
|
|
6
|
+
Custom,
|
|
7
|
+
Dock,
|
|
8
|
+
IMenu,
|
|
9
|
+
IObject,
|
|
10
|
+
IPosition,
|
|
11
|
+
ISiyuan,
|
|
12
|
+
IWebSocketData,
|
|
13
|
+
IProtyle,
|
|
14
|
+
Lute,
|
|
15
|
+
Protyle,
|
|
16
|
+
Toolbar,
|
|
17
|
+
IProtyleOptions,
|
|
18
|
+
TProtyleAction,
|
|
19
|
+
subMenu,
|
|
20
|
+
App,
|
|
21
|
+
Files,
|
|
22
|
+
Tab, Model,
|
|
23
|
+
} from "./types";
|
|
2
24
|
|
|
3
|
-
|
|
4
|
-
import {Config} from "./types/config";
|
|
5
|
-
import {IMenuBaseDetail} from "./types/events";
|
|
6
|
-
import {IGetDocInfo, IGetTreeStat} from "./types/response";
|
|
25
|
+
export * from "./types";
|
|
7
26
|
|
|
8
27
|
declare global {
|
|
9
28
|
export interface Window extends Global {
|
|
10
29
|
}
|
|
11
30
|
}
|
|
12
31
|
|
|
13
|
-
export type
|
|
32
|
+
export type TDock = "file" | "outline" | "inbox" | "bookmark" | "tag" | "graph" | "globalGraph" | "backlink"
|
|
14
33
|
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
export type TTurnIntoOneSub = "row" | "col"
|
|
34
|
+
export type TCardType = "doc" | "notebook" | "all"
|
|
18
35
|
|
|
19
|
-
export type
|
|
36
|
+
export type TEventBus = keyof IEventBusMap
|
|
20
37
|
|
|
21
|
-
export type
|
|
38
|
+
export type TPluginDockPosition = "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight"
|
|
22
39
|
|
|
23
40
|
export type TOperation =
|
|
24
41
|
"insert"
|
|
@@ -52,68 +69,18 @@ export type TOperation =
|
|
|
52
69
|
| "setAttrViewColCalc"
|
|
53
70
|
| "updateAttrViewColNumberFormat"
|
|
54
71
|
|
|
55
|
-
export type TAVCol =
|
|
56
|
-
"text"
|
|
57
|
-
| "date"
|
|
58
|
-
| "number"
|
|
59
|
-
| "relation"
|
|
60
|
-
| "rollup"
|
|
61
|
-
| "select"
|
|
62
|
-
| "block"
|
|
63
|
-
| "mSelect"
|
|
64
|
-
| "url"
|
|
65
|
-
| "email"
|
|
66
|
-
| "phone"
|
|
67
|
-
|
|
68
|
-
export interface ISiyuan {
|
|
69
|
-
config: Config.IConf;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
72
|
export interface Global {
|
|
73
73
|
Lute: typeof Lute;
|
|
74
74
|
siyuan: ISiyuan;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
interface IKeymapItem {
|
|
78
|
-
default: string,
|
|
79
|
-
custom: string
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface IKeymap {
|
|
83
|
-
plugin: {
|
|
84
|
-
[key: string]: {
|
|
85
|
-
[key: string]: IKeymapItem
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
general: {
|
|
89
|
-
[key: string]: IKeymapItem
|
|
90
|
-
}
|
|
91
|
-
editor: {
|
|
92
|
-
general: {
|
|
93
|
-
[key: string]: IKeymapItem
|
|
94
|
-
}
|
|
95
|
-
insert: {
|
|
96
|
-
[key: string]: IKeymapItem
|
|
97
|
-
}
|
|
98
|
-
heading: {
|
|
99
|
-
[key: string]: IKeymapItem
|
|
100
|
-
}
|
|
101
|
-
list: {
|
|
102
|
-
[key: string]: IKeymapItem
|
|
103
|
-
}
|
|
104
|
-
table: {
|
|
105
|
-
[key: string]: IKeymapItem
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
77
|
export interface IEventBusMap {
|
|
111
78
|
"click-flashcard-action": {
|
|
112
79
|
card: ICard,
|
|
113
80
|
type: string, // 1 - 重来;2 - 困难;3 - 良好;4 - 简单;-1 - 显示答案;-2 - 上一个 ;-3 - 跳过
|
|
114
81
|
};
|
|
115
82
|
"click-blockicon": {
|
|
116
|
-
menu:
|
|
83
|
+
menu: subMenu,
|
|
117
84
|
protyle: IProtyle,
|
|
118
85
|
blockElements: HTMLElement[],
|
|
119
86
|
};
|
|
@@ -122,19 +89,20 @@ export interface IEventBusMap {
|
|
|
122
89
|
event: MouseEvent,
|
|
123
90
|
};
|
|
124
91
|
"click-editortitleicon": {
|
|
125
|
-
menu:
|
|
92
|
+
menu: subMenu,
|
|
126
93
|
protyle: IProtyle,
|
|
127
94
|
data: IGetDocInfo,
|
|
128
95
|
};
|
|
129
96
|
"click-pdf": {
|
|
130
97
|
event: MouseEvent,
|
|
131
98
|
};
|
|
99
|
+
"closed-notebook": IWebSocketData;
|
|
132
100
|
"destroy-protyle": {
|
|
133
101
|
protyle: IProtyle,
|
|
134
102
|
};
|
|
135
103
|
"input-search": {
|
|
136
104
|
protyle: Protyle,
|
|
137
|
-
config:
|
|
105
|
+
config: Config.IUILayoutTabSearchConfig,
|
|
138
106
|
searchElement: HTMLInputElement,
|
|
139
107
|
};
|
|
140
108
|
"loaded-protyle-dynamic": {
|
|
@@ -144,13 +112,14 @@ export interface IEventBusMap {
|
|
|
144
112
|
"loaded-protyle-static": {
|
|
145
113
|
protyle: IProtyle,
|
|
146
114
|
};
|
|
115
|
+
"lock-screen": void;
|
|
147
116
|
"switch-protyle": {
|
|
148
117
|
protyle: IProtyle,
|
|
149
118
|
};
|
|
150
119
|
"open-menu-av": IMenuBaseDetail & { selectRowElements: HTMLElement[] };
|
|
151
120
|
"open-menu-blockref": IMenuBaseDetail;
|
|
152
121
|
"open-menu-breadcrumbmore": {
|
|
153
|
-
menu:
|
|
122
|
+
menu: subMenu,
|
|
154
123
|
protyle: IProtyle,
|
|
155
124
|
data: IGetTreeStat,
|
|
156
125
|
};
|
|
@@ -160,18 +129,20 @@ export interface IEventBusMap {
|
|
|
160
129
|
"open-menu-link": IMenuBaseDetail;
|
|
161
130
|
"open-menu-tag": IMenuBaseDetail;
|
|
162
131
|
"open-menu-doctree": {
|
|
163
|
-
menu:
|
|
132
|
+
menu: subMenu,
|
|
164
133
|
elements: NodeListOf<HTMLElement>,
|
|
165
134
|
type: "doc" | "docs" | "notebook",
|
|
166
135
|
};
|
|
167
136
|
"open-menu-inbox": {
|
|
168
|
-
menu:
|
|
137
|
+
menu: subMenu,
|
|
169
138
|
element: HTMLElement,
|
|
170
139
|
ids: string[],
|
|
171
140
|
};
|
|
172
141
|
"open-noneditableblock": {
|
|
173
142
|
protyle: IProtyle,
|
|
174
143
|
toolbar: Toolbar,
|
|
144
|
+
blockElement: HTMLElement,
|
|
145
|
+
renderElement: HTMLElement,
|
|
175
146
|
};
|
|
176
147
|
"open-siyuan-url-block": {
|
|
177
148
|
url: string,
|
|
@@ -183,170 +154,35 @@ export interface IEventBusMap {
|
|
|
183
154
|
url: string,
|
|
184
155
|
};
|
|
185
156
|
"opened-notebook": IWebSocketData;
|
|
186
|
-
"closed-notebook":IWebSocketData;
|
|
187
157
|
"paste": {
|
|
188
158
|
protyle: IProtyle,
|
|
189
159
|
resolve: new <T>(value: T | PromiseLike<T>) => void,
|
|
190
160
|
textHTML: string,
|
|
191
161
|
textPlain: string,
|
|
192
162
|
siyuanHTML: string,
|
|
193
|
-
files: FileList | DataTransferItemList;
|
|
163
|
+
files: FileList | DataTransferItemList | string[]; // 读取本地文件时为 string[]
|
|
194
164
|
}
|
|
195
165
|
"ws-main": IWebSocketData;
|
|
196
166
|
"sync-start": IWebSocketData;
|
|
197
167
|
"sync-end": IWebSocketData;
|
|
198
168
|
"sync-fail": IWebSocketData;
|
|
199
|
-
"lock-screen": void;
|
|
200
169
|
"mobile-keyboard-show": void;
|
|
201
170
|
"mobile-keyboard-hide": void;
|
|
202
171
|
}
|
|
203
172
|
|
|
204
|
-
export interface IPosition {
|
|
205
|
-
x: number;
|
|
206
|
-
y: number;
|
|
207
|
-
w?: number;
|
|
208
|
-
h?: number;
|
|
209
|
-
isLeft?: boolean;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
export interface ITab {
|
|
213
|
-
id: string;
|
|
214
|
-
headElement: HTMLElement;
|
|
215
|
-
panelElement: HTMLElement;
|
|
216
|
-
model: IModel;
|
|
217
|
-
title: string;
|
|
218
|
-
icon: string;
|
|
219
|
-
docIcon: string;
|
|
220
|
-
updateTitle: (title: string) => void;
|
|
221
|
-
pin: () => void;
|
|
222
|
-
unpin: () => void;
|
|
223
|
-
setDocIcon: (icon: string) => void;
|
|
224
|
-
close: () => void;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export interface IModel {
|
|
228
|
-
ws: WebSocket;
|
|
229
|
-
app: App;
|
|
230
|
-
reqId: number;
|
|
231
|
-
parent: ITab | any;
|
|
232
|
-
|
|
233
|
-
send(cmd: string, param: Record<string, unknown>, process?: boolean): void;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
export interface ICustomModel extends IModel {
|
|
237
|
-
tab: ITab;
|
|
238
|
-
data: any;
|
|
239
|
-
type: string;
|
|
240
|
-
element: HTMLElement;
|
|
241
|
-
editors: Protyle[]; // 系统内部处理快捷键等操作需要用到 https://github.com/siyuan-note/siyuan/issues/11072
|
|
242
|
-
|
|
243
|
-
init(): void;
|
|
244
|
-
|
|
245
|
-
update?(): void;
|
|
246
|
-
|
|
247
|
-
resize?(): void;
|
|
248
|
-
|
|
249
|
-
beforeDestroy?(): void;
|
|
250
|
-
|
|
251
|
-
destroy?(): void;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export interface IDockModel extends Omit<ICustomModel, "beforeDestroy"> {
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
export interface ITabModel extends ICustomModel {
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export interface IObject {
|
|
261
|
-
[key: string]: string;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export interface I18N {
|
|
265
|
-
[key: string]: any;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
export interface ILuteNode {
|
|
269
|
-
TokensStr: () => string;
|
|
270
|
-
__internal_object__: {
|
|
271
|
-
Parent: {
|
|
272
|
-
Type: number,
|
|
273
|
-
},
|
|
274
|
-
HeadingLevel: string,
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
export interface ISearchOption {
|
|
279
|
-
page?: number;
|
|
280
|
-
removed?: boolean; // 移除后需记录搜索内容 https://github.com/siyuan-note/siyuan/issues/7745
|
|
281
|
-
name?: string;
|
|
282
|
-
sort?: number; // 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序
|
|
283
|
-
group?: number; // 0:不分组,1:按文档分组
|
|
284
|
-
hasReplace?: boolean;
|
|
285
|
-
method?: number; // 0:文本,1:查询语法,2:SQL,3:正则表达式
|
|
286
|
-
hPath?: string;
|
|
287
|
-
idPath?: string[];
|
|
288
|
-
k: string;
|
|
289
|
-
r?: string;
|
|
290
|
-
types?: {
|
|
291
|
-
mathBlock: boolean,
|
|
292
|
-
table: boolean,
|
|
293
|
-
blockquote: boolean,
|
|
294
|
-
superBlock: boolean,
|
|
295
|
-
paragraph: boolean,
|
|
296
|
-
document: boolean,
|
|
297
|
-
heading: boolean,
|
|
298
|
-
list: boolean,
|
|
299
|
-
listItem: boolean,
|
|
300
|
-
codeBlock: boolean,
|
|
301
|
-
htmlBlock: boolean,
|
|
302
|
-
embedBlock: boolean,
|
|
303
|
-
databaseBlock: boolean,
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export interface IWebSocketData {
|
|
308
|
-
cmd: string;
|
|
309
|
-
callback?: string;
|
|
310
|
-
data: any;
|
|
311
|
-
msg: string;
|
|
312
|
-
code: number;
|
|
313
|
-
sid: string;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
173
|
export interface IPluginDockTab {
|
|
317
|
-
position:
|
|
318
|
-
size:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
title: string;
|
|
325
|
-
index?: number;
|
|
326
|
-
show?: boolean;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export interface IMenuItemOption {
|
|
330
|
-
iconClass?: string;
|
|
331
|
-
label?: string;
|
|
332
|
-
click?: (element: HTMLElement, event: MouseEvent) => boolean | void | Promise<boolean | void>;
|
|
333
|
-
type?: "separator" | "submenu" | "readonly";
|
|
334
|
-
accelerator?: string;
|
|
335
|
-
action?: string;
|
|
336
|
-
id?: string;
|
|
337
|
-
submenu?: IMenuItemOption[];
|
|
338
|
-
disabled?: boolean;
|
|
339
|
-
icon?: string;
|
|
340
|
-
iconHTML?: string;
|
|
341
|
-
current?: boolean;
|
|
342
|
-
bind?: (element: HTMLElement) => void;
|
|
343
|
-
index?: number;
|
|
344
|
-
element?: HTMLElement;
|
|
174
|
+
position: TPluginDockPosition,
|
|
175
|
+
size: Config.IUILayoutDockPanelSize,
|
|
176
|
+
icon: string,
|
|
177
|
+
hotkey?: string,
|
|
178
|
+
title: string,
|
|
179
|
+
index?: number
|
|
180
|
+
show?: boolean
|
|
345
181
|
}
|
|
346
182
|
|
|
347
|
-
export interface
|
|
348
|
-
langKey: string // 用于区分不同快捷键的 key
|
|
349
|
-
langText?: string //
|
|
183
|
+
export interface ICommand {
|
|
184
|
+
langKey: string, // 用于区分不同快捷键的 key, 同时作为 i18n 的字段名
|
|
185
|
+
langText?: string, // 显示的文本, 指定后不再使用 langKey 对应的 i18n 文本
|
|
350
186
|
/**
|
|
351
187
|
* 目前需使用 MacOS 符号标识,顺序按照 ⌥⇧⌘,入 ⌥⇧⌘A
|
|
352
188
|
* "Ctrl": "⌘",
|
|
@@ -359,33 +195,11 @@ export interface ICommandOption {
|
|
|
359
195
|
*/
|
|
360
196
|
hotkey: string,
|
|
361
197
|
customHotkey?: string,
|
|
362
|
-
callback?: () => void
|
|
198
|
+
callback?: () => void // 其余回调存在时将不会触
|
|
363
199
|
globalCallback?: () => void // 焦点不在应用内时执行的回调
|
|
364
|
-
fileTreeCallback?: (file:
|
|
365
|
-
editorCallback?: (protyle:
|
|
366
|
-
dockCallback?: (element: HTMLElement) => void
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
export interface IOperation {
|
|
370
|
-
action: TOperation; // move, delete 不需要传 data
|
|
371
|
-
id?: string;
|
|
372
|
-
isTwoWay?: boolean; // 是否双向关联
|
|
373
|
-
backRelationKeyID?: string; // 双向关联的目标关联列 ID
|
|
374
|
-
avID?: string; // av
|
|
375
|
-
format?: string; // updateAttrViewColNumberFormat 专享
|
|
376
|
-
keyID?: string; // updateAttrViewCell 专享
|
|
377
|
-
rowID?: string; // updateAttrViewCell 专享
|
|
378
|
-
data?: any; // updateAttr 时为 { old: IObject, new: IObject }, updateAttrViewCell 时为 {TAVCol: {content: string}}
|
|
379
|
-
parentID?: string;
|
|
380
|
-
previousID?: string;
|
|
381
|
-
retData?: any;
|
|
382
|
-
nextID?: string; // insert 专享
|
|
383
|
-
isDetached?: boolean; // insertAttrViewBlock 专享
|
|
384
|
-
srcIDs?: string[]; // insertAttrViewBlock 专享
|
|
385
|
-
name?: string; // addAttrViewCol 专享
|
|
386
|
-
type?: TAVCol; // addAttrViewCol 专享
|
|
387
|
-
deckID?: string; // add/removeFlashcards 专享
|
|
388
|
-
blockIDs?: string[]; // add/removeFlashcards 专享
|
|
200
|
+
fileTreeCallback?: (file: Files) => void // 焦点在文档树上时执行的回调
|
|
201
|
+
editorCallback?: (protyle: IProtyle) => void // 焦点在编辑器上时执行的回调
|
|
202
|
+
dockCallback?: (element: HTMLElement) => void // 焦点在 dock 上时执行的回调
|
|
389
203
|
}
|
|
390
204
|
|
|
391
205
|
export interface ICard {
|
|
@@ -393,6 +207,10 @@ export interface ICard {
|
|
|
393
207
|
cardID: string
|
|
394
208
|
blockID: string
|
|
395
209
|
nextDues: IObject
|
|
210
|
+
lapses: number // 遗忘次数
|
|
211
|
+
lastReview: number // 最后复习时间
|
|
212
|
+
reps: number // 复习次数
|
|
213
|
+
state: number // 卡片状态 0:新卡
|
|
396
214
|
}
|
|
397
215
|
|
|
398
216
|
export interface ICardData {
|
|
@@ -402,6 +220,10 @@ export interface ICardData {
|
|
|
402
220
|
unreviewedOldCardCount: number
|
|
403
221
|
}
|
|
404
222
|
|
|
223
|
+
export function adaptHotkey(hotkey: string): string
|
|
224
|
+
|
|
225
|
+
export function confirm(title: string, text: string, confirmCallback?: (dialog: Dialog) => void, cancelCallback?: (dialog: Dialog) => void): void;
|
|
226
|
+
|
|
405
227
|
export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
|
|
406
228
|
|
|
407
229
|
export function fetchSyncPost(url: string, data?: any): Promise<IWebSocketData>;
|
|
@@ -415,13 +237,13 @@ export function openWindow(options: {
|
|
|
415
237
|
},
|
|
416
238
|
height?: number,
|
|
417
239
|
width?: number,
|
|
418
|
-
tab?:
|
|
240
|
+
tab?: Tab,
|
|
419
241
|
doc?: {
|
|
420
242
|
id: string; // 块 id
|
|
421
243
|
},
|
|
422
244
|
}): void;
|
|
423
245
|
|
|
424
|
-
export function openMobileFileById(app: App, id: string, action?:
|
|
246
|
+
export function openMobileFileById(app: App, id: string, action?: TProtyleAction[]): void;
|
|
425
247
|
|
|
426
248
|
export function openTab(options: {
|
|
427
249
|
app: App,
|
|
@@ -438,7 +260,7 @@ export function openTab(options: {
|
|
|
438
260
|
asset?: {
|
|
439
261
|
path: string,
|
|
440
262
|
};
|
|
441
|
-
search?:
|
|
263
|
+
search?: Config.IUILayoutTabSearchConfig;
|
|
442
264
|
card?: {
|
|
443
265
|
type: TCardType,
|
|
444
266
|
id?: string, // cardType 为 all 时不传,否则传文档或笔记本 id
|
|
@@ -454,19 +276,19 @@ export function openTab(options: {
|
|
|
454
276
|
keepCursor?: boolean; // 是否跳转到新 tab 上
|
|
455
277
|
removeCurrentTab?: boolean; // 在当前页签打开时需移除原有页签
|
|
456
278
|
afterOpen?: () => void; // 打开后回调
|
|
457
|
-
}): Promise<
|
|
279
|
+
}): Promise<Tab>
|
|
458
280
|
|
|
459
281
|
export function getFrontend(): "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile";
|
|
460
282
|
|
|
283
|
+
export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios";
|
|
284
|
+
|
|
461
285
|
export function lockScreen(app: App): void
|
|
462
286
|
|
|
463
287
|
export function exitSiYuan(): void
|
|
464
288
|
|
|
465
|
-
export function
|
|
466
|
-
|
|
467
|
-
export function adaptHotkey(hotkey: string): string;
|
|
289
|
+
export function getAllEditor(): Protyle[]
|
|
468
290
|
|
|
469
|
-
export function
|
|
291
|
+
export function getModelByDockType(type: TDock | string): Model | any;
|
|
470
292
|
|
|
471
293
|
/**
|
|
472
294
|
* @param timeout - ms. 0: manual close;-1: always show; 6000: default
|
|
@@ -474,19 +296,14 @@ export function confirm(title: string, text: string, confirmCallback?: (dialog:
|
|
|
474
296
|
*/
|
|
475
297
|
export function showMessage(text: string, timeout?: number, type?: "info" | "error", id?: string): void;
|
|
476
298
|
|
|
477
|
-
export class App {
|
|
478
|
-
plugins: Plugin[];
|
|
479
|
-
appId: string
|
|
480
|
-
}
|
|
481
|
-
|
|
482
299
|
export abstract class Plugin {
|
|
483
300
|
eventBus: EventBus;
|
|
484
|
-
i18n:
|
|
301
|
+
i18n: IObject;
|
|
485
302
|
data: any;
|
|
486
303
|
displayName: string;
|
|
487
304
|
readonly name: string;
|
|
488
305
|
app: App;
|
|
489
|
-
commands:
|
|
306
|
+
commands: ICommand[];
|
|
490
307
|
setting: Setting;
|
|
491
308
|
protyleSlash: {
|
|
492
309
|
filter: string[],
|
|
@@ -494,12 +311,12 @@ export abstract class Plugin {
|
|
|
494
311
|
id: string,
|
|
495
312
|
callback(protyle: Protyle): void,
|
|
496
313
|
}[];
|
|
497
|
-
protyleOptions:
|
|
314
|
+
protyleOptions: IProtyleOptions;
|
|
498
315
|
|
|
499
316
|
constructor(options: {
|
|
500
317
|
app: App,
|
|
501
318
|
name: string,
|
|
502
|
-
i18n:
|
|
319
|
+
i18n: IObject,
|
|
503
320
|
});
|
|
504
321
|
|
|
505
322
|
onload(): void;
|
|
@@ -541,19 +358,19 @@ export abstract class Plugin {
|
|
|
541
358
|
|
|
542
359
|
addIcons(svg: string): void;
|
|
543
360
|
|
|
544
|
-
getOpenedTab(): { [key: string]:
|
|
361
|
+
getOpenedTab(): { [key: string]: Custom[] };
|
|
545
362
|
|
|
546
363
|
/**
|
|
547
364
|
* Must be executed before the synchronous function.
|
|
548
365
|
*/
|
|
549
366
|
addTab(options: {
|
|
550
367
|
type: string,
|
|
551
|
-
beforeDestroy?: (this:
|
|
552
|
-
destroy?: (this:
|
|
553
|
-
resize?: (this:
|
|
554
|
-
update?: (this:
|
|
555
|
-
init: (this:
|
|
556
|
-
}): () =>
|
|
368
|
+
beforeDestroy?: (this: Custom) => void,
|
|
369
|
+
destroy?: (this: Custom) => void,
|
|
370
|
+
resize?: (this: Custom) => void,
|
|
371
|
+
update?: (this: Custom) => void,
|
|
372
|
+
init: (this: Custom) => void,
|
|
373
|
+
}): () => Custom;
|
|
557
374
|
|
|
558
375
|
/**
|
|
559
376
|
* Must be executed before the synchronous function.
|
|
@@ -562,13 +379,13 @@ export abstract class Plugin {
|
|
|
562
379
|
config: IPluginDockTab,
|
|
563
380
|
data: any,
|
|
564
381
|
type: string,
|
|
565
|
-
destroy?: (this:
|
|
566
|
-
resize?: (this:
|
|
567
|
-
update?: (this:
|
|
568
|
-
init: (this:
|
|
569
|
-
}): { config: IPluginDockTab, model:
|
|
382
|
+
destroy?: (this: Dock) => void,
|
|
383
|
+
resize?: (this: Dock) => void,
|
|
384
|
+
update?: (this: Dock) => void,
|
|
385
|
+
init: (this: Dock, dock: Dock) => void,
|
|
386
|
+
}): { config: IPluginDockTab, model: Dock };
|
|
570
387
|
|
|
571
|
-
addCommand(options:
|
|
388
|
+
addCommand(options: ICommand): void;
|
|
572
389
|
|
|
573
390
|
addFloatLayer(options: {
|
|
574
391
|
ids: string[],
|
|
@@ -648,17 +465,19 @@ export class Dialog {
|
|
|
648
465
|
}
|
|
649
466
|
|
|
650
467
|
export class Menu {
|
|
651
|
-
|
|
652
|
-
|
|
468
|
+
private menu;
|
|
469
|
+
isOpen: boolean;
|
|
653
470
|
element: HTMLElement;
|
|
654
471
|
|
|
472
|
+
constructor(id?: string, closeCB?: () => void);
|
|
473
|
+
|
|
655
474
|
showSubMenu(subMenuElement: HTMLElement): void;
|
|
656
475
|
|
|
657
|
-
addItem(
|
|
476
|
+
addItem(option: IMenu): HTMLElement;
|
|
658
477
|
|
|
659
|
-
addSeparator(index?: number):
|
|
478
|
+
addSeparator(index?: number, ignore?: boolean): HTMLElement;
|
|
660
479
|
|
|
661
|
-
open(options:
|
|
480
|
+
open(options: IPosition): void;
|
|
662
481
|
|
|
663
482
|
/**
|
|
664
483
|
* @param {string} [position=all]
|
|
@@ -667,13 +486,3 @@ export class Menu {
|
|
|
667
486
|
|
|
668
487
|
close(): void;
|
|
669
488
|
}
|
|
670
|
-
|
|
671
|
-
export class EventMenu {
|
|
672
|
-
public menus: IMenuItemOption[];
|
|
673
|
-
|
|
674
|
-
constructor();
|
|
675
|
-
|
|
676
|
-
public addSeparator(index?: number): void;
|
|
677
|
-
|
|
678
|
-
public addItem(menu: IMenuItemOption): void;
|
|
679
|
-
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {Protyle} from "../protyle";
|
|
2
|
+
import {App} from "../index";
|
|
3
|
+
|
|
4
|
+
export declare class BlockPanel {
|
|
5
|
+
element: HTMLElement;
|
|
6
|
+
targetElement: HTMLElement;
|
|
7
|
+
nodeIds: string[];
|
|
8
|
+
defIds: string[];
|
|
9
|
+
id: string;
|
|
10
|
+
private app;
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
private isBacklink;
|
|
14
|
+
editors: Protyle[];
|
|
15
|
+
constructor(options: {
|
|
16
|
+
app: App;
|
|
17
|
+
targetElement?: HTMLElement;
|
|
18
|
+
nodeIds?: string[];
|
|
19
|
+
defIds?: string[];
|
|
20
|
+
isBacklink: boolean;
|
|
21
|
+
x?: number;
|
|
22
|
+
y?: number;
|
|
23
|
+
});
|
|
24
|
+
private initProtyle;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
private render;
|
|
27
|
+
}
|