siyuan 1.0.4 → 1.0.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 +15 -2
- package/package.json +1 -1
- package/siyuan.d.ts +96 -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,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## v1.0.
|
|
3
|
+
## v1.0.7 2024-11
|
|
4
|
+
|
|
5
|
+
## v1.0.6 2024-11-19
|
|
6
|
+
|
|
7
|
+
* [Add plugin method `updateProtyleToolbar`](https://github.com/siyuan-note/plugin-sample/issues/24)
|
|
8
|
+
|
|
9
|
+
## v1.0.5 2024-11-05
|
|
10
|
+
|
|
11
|
+
* [Add `renderElement` and `blockElement` for `open-noneditableblock`](https://github.com/siyuan-note/siyuan/issues/12955)
|
|
12
|
+
* [Add plugin util `platformUtils`](https://github.com/siyuan-note/siyuan/issues/12930)
|
|
13
|
+
* [Added reading local files to `on-paste`](https://github.com/siyuan-note/siyuan/issues/12917)
|
|
14
|
+
* [Add plugin function `getAllEditor`](https://github.com/siyuan-note/siyuan/issues/12884)
|
|
15
|
+
* [Add plugin function `getModelByDockType`](https://github.com/siyuan-note/siyuan/issues/11782)
|
|
16
|
+
* [Replace `any` in IProtyle with the corresponding type](https://github.com/siyuan-note/petal/issues/34)
|
|
4
17
|
|
|
5
18
|
## v1.0.4 2024-10-15
|
|
6
19
|
|
|
7
|
-
* [Add plugin method `exitSiYuan`]https://github.com/siyuan-note/siyuan/pull/12767)
|
|
20
|
+
* [Add plugin method `exitSiYuan`](https://github.com/siyuan-note/siyuan/pull/12767)
|
|
8
21
|
|
|
9
22
|
## v1.0.3 2024-09-27
|
|
10
23
|
|
package/package.json
CHANGED
package/siyuan.d.ts
CHANGED
|
@@ -1,24 +1,42 @@
|
|
|
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
|
+
IMenuItem,
|
|
24
|
+
} from "./types";
|
|
2
25
|
|
|
3
|
-
|
|
4
|
-
import {Config} from "./types/config";
|
|
5
|
-
import {IMenuBaseDetail} from "./types/events";
|
|
6
|
-
import {IGetDocInfo, IGetTreeStat} from "./types/response";
|
|
26
|
+
export * from "./types";
|
|
7
27
|
|
|
8
28
|
declare global {
|
|
9
29
|
export interface Window extends Global {
|
|
10
30
|
}
|
|
11
31
|
}
|
|
12
32
|
|
|
13
|
-
export type
|
|
33
|
+
export type TDock = "file" | "outline" | "inbox" | "bookmark" | "tag" | "graph" | "globalGraph" | "backlink"
|
|
14
34
|
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
export type TTurnIntoOneSub = "row" | "col"
|
|
35
|
+
export type TCardType = "doc" | "notebook" | "all"
|
|
18
36
|
|
|
19
|
-
export type
|
|
37
|
+
export type TEventBus = keyof IEventBusMap
|
|
20
38
|
|
|
21
|
-
export type
|
|
39
|
+
export type TPluginDockPosition = "LeftTop" | "LeftBottom" | "RightTop" | "RightBottom" | "BottomLeft" | "BottomRight"
|
|
22
40
|
|
|
23
41
|
export type TOperation =
|
|
24
42
|
"insert"
|
|
@@ -52,68 +70,18 @@ export type TOperation =
|
|
|
52
70
|
| "setAttrViewColCalc"
|
|
53
71
|
| "updateAttrViewColNumberFormat"
|
|
54
72
|
|
|
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
73
|
export interface Global {
|
|
73
74
|
Lute: typeof Lute;
|
|
74
75
|
siyuan: ISiyuan;
|
|
75
76
|
}
|
|
76
77
|
|
|
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
78
|
export interface IEventBusMap {
|
|
111
79
|
"click-flashcard-action": {
|
|
112
80
|
card: ICard,
|
|
113
81
|
type: string, // 1 - 重来;2 - 困难;3 - 良好;4 - 简单;-1 - 显示答案;-2 - 上一个 ;-3 - 跳过
|
|
114
82
|
};
|
|
115
83
|
"click-blockicon": {
|
|
116
|
-
menu:
|
|
84
|
+
menu: subMenu,
|
|
117
85
|
protyle: IProtyle,
|
|
118
86
|
blockElements: HTMLElement[],
|
|
119
87
|
};
|
|
@@ -122,19 +90,20 @@ export interface IEventBusMap {
|
|
|
122
90
|
event: MouseEvent,
|
|
123
91
|
};
|
|
124
92
|
"click-editortitleicon": {
|
|
125
|
-
menu:
|
|
93
|
+
menu: subMenu,
|
|
126
94
|
protyle: IProtyle,
|
|
127
95
|
data: IGetDocInfo,
|
|
128
96
|
};
|
|
129
97
|
"click-pdf": {
|
|
130
98
|
event: MouseEvent,
|
|
131
99
|
};
|
|
100
|
+
"closed-notebook": IWebSocketData;
|
|
132
101
|
"destroy-protyle": {
|
|
133
102
|
protyle: IProtyle,
|
|
134
103
|
};
|
|
135
104
|
"input-search": {
|
|
136
105
|
protyle: Protyle,
|
|
137
|
-
config:
|
|
106
|
+
config: Config.IUILayoutTabSearchConfig,
|
|
138
107
|
searchElement: HTMLInputElement,
|
|
139
108
|
};
|
|
140
109
|
"loaded-protyle-dynamic": {
|
|
@@ -144,13 +113,14 @@ export interface IEventBusMap {
|
|
|
144
113
|
"loaded-protyle-static": {
|
|
145
114
|
protyle: IProtyle,
|
|
146
115
|
};
|
|
116
|
+
"lock-screen": void;
|
|
147
117
|
"switch-protyle": {
|
|
148
118
|
protyle: IProtyle,
|
|
149
119
|
};
|
|
150
120
|
"open-menu-av": IMenuBaseDetail & { selectRowElements: HTMLElement[] };
|
|
151
121
|
"open-menu-blockref": IMenuBaseDetail;
|
|
152
122
|
"open-menu-breadcrumbmore": {
|
|
153
|
-
menu:
|
|
123
|
+
menu: subMenu,
|
|
154
124
|
protyle: IProtyle,
|
|
155
125
|
data: IGetTreeStat,
|
|
156
126
|
};
|
|
@@ -160,18 +130,20 @@ export interface IEventBusMap {
|
|
|
160
130
|
"open-menu-link": IMenuBaseDetail;
|
|
161
131
|
"open-menu-tag": IMenuBaseDetail;
|
|
162
132
|
"open-menu-doctree": {
|
|
163
|
-
menu:
|
|
133
|
+
menu: subMenu,
|
|
164
134
|
elements: NodeListOf<HTMLElement>,
|
|
165
135
|
type: "doc" | "docs" | "notebook",
|
|
166
136
|
};
|
|
167
137
|
"open-menu-inbox": {
|
|
168
|
-
menu:
|
|
138
|
+
menu: subMenu,
|
|
169
139
|
element: HTMLElement,
|
|
170
140
|
ids: string[],
|
|
171
141
|
};
|
|
172
142
|
"open-noneditableblock": {
|
|
173
143
|
protyle: IProtyle,
|
|
174
144
|
toolbar: Toolbar,
|
|
145
|
+
blockElement: HTMLElement,
|
|
146
|
+
renderElement: HTMLElement,
|
|
175
147
|
};
|
|
176
148
|
"open-siyuan-url-block": {
|
|
177
149
|
url: string,
|
|
@@ -183,170 +155,35 @@ export interface IEventBusMap {
|
|
|
183
155
|
url: string,
|
|
184
156
|
};
|
|
185
157
|
"opened-notebook": IWebSocketData;
|
|
186
|
-
"closed-notebook":IWebSocketData;
|
|
187
158
|
"paste": {
|
|
188
159
|
protyle: IProtyle,
|
|
189
160
|
resolve: new <T>(value: T | PromiseLike<T>) => void,
|
|
190
161
|
textHTML: string,
|
|
191
162
|
textPlain: string,
|
|
192
163
|
siyuanHTML: string,
|
|
193
|
-
files: FileList | DataTransferItemList;
|
|
164
|
+
files: FileList | DataTransferItemList | string[]; // 读取本地文件时为 string[]
|
|
194
165
|
}
|
|
195
166
|
"ws-main": IWebSocketData;
|
|
196
167
|
"sync-start": IWebSocketData;
|
|
197
168
|
"sync-end": IWebSocketData;
|
|
198
169
|
"sync-fail": IWebSocketData;
|
|
199
|
-
"lock-screen": void;
|
|
200
170
|
"mobile-keyboard-show": void;
|
|
201
171
|
"mobile-keyboard-hide": void;
|
|
202
172
|
}
|
|
203
173
|
|
|
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
174
|
export interface IPluginDockTab {
|
|
317
|
-
position:
|
|
318
|
-
size:
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
title: string;
|
|
325
|
-
index?: number;
|
|
326
|
-
show?: boolean;
|
|
175
|
+
position: TPluginDockPosition,
|
|
176
|
+
size: Config.IUILayoutDockPanelSize,
|
|
177
|
+
icon: string,
|
|
178
|
+
hotkey?: string,
|
|
179
|
+
title: string,
|
|
180
|
+
index?: number
|
|
181
|
+
show?: boolean
|
|
327
182
|
}
|
|
328
183
|
|
|
329
|
-
export interface
|
|
330
|
-
|
|
331
|
-
|
|
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;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
export interface ICommandOption {
|
|
348
|
-
langKey: string // 用于区分不同快捷键的 key
|
|
349
|
-
langText?: string // 快捷键功能描述文本
|
|
184
|
+
export interface ICommand {
|
|
185
|
+
langKey: string, // 用于区分不同快捷键的 key, 同时作为 i18n 的字段名
|
|
186
|
+
langText?: string, // 显示的文本, 指定后不再使用 langKey 对应的 i18n 文本
|
|
350
187
|
/**
|
|
351
188
|
* 目前需使用 MacOS 符号标识,顺序按照 ⌥⇧⌘,入 ⌥⇧⌘A
|
|
352
189
|
* "Ctrl": "⌘",
|
|
@@ -359,33 +196,11 @@ export interface ICommandOption {
|
|
|
359
196
|
*/
|
|
360
197
|
hotkey: string,
|
|
361
198
|
customHotkey?: string,
|
|
362
|
-
callback?: () => void
|
|
199
|
+
callback?: () => void // 其余回调存在时将不会触
|
|
363
200
|
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 专享
|
|
201
|
+
fileTreeCallback?: (file: Files) => void // 焦点在文档树上时执行的回调
|
|
202
|
+
editorCallback?: (protyle: IProtyle) => void // 焦点在编辑器上时执行的回调
|
|
203
|
+
dockCallback?: (element: HTMLElement) => void // 焦点在 dock 上时执行的回调
|
|
389
204
|
}
|
|
390
205
|
|
|
391
206
|
export interface ICard {
|
|
@@ -393,6 +208,10 @@ export interface ICard {
|
|
|
393
208
|
cardID: string
|
|
394
209
|
blockID: string
|
|
395
210
|
nextDues: IObject
|
|
211
|
+
lapses: number // 遗忘次数
|
|
212
|
+
lastReview: number // 最后复习时间
|
|
213
|
+
reps: number // 复习次数
|
|
214
|
+
state: number // 卡片状态 0:新卡
|
|
396
215
|
}
|
|
397
216
|
|
|
398
217
|
export interface ICardData {
|
|
@@ -402,6 +221,10 @@ export interface ICardData {
|
|
|
402
221
|
unreviewedOldCardCount: number
|
|
403
222
|
}
|
|
404
223
|
|
|
224
|
+
export function adaptHotkey(hotkey: string): string
|
|
225
|
+
|
|
226
|
+
export function confirm(title: string, text: string, confirmCallback?: (dialog: Dialog) => void, cancelCallback?: (dialog: Dialog) => void): void;
|
|
227
|
+
|
|
405
228
|
export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
|
|
406
229
|
|
|
407
230
|
export function fetchSyncPost(url: string, data?: any): Promise<IWebSocketData>;
|
|
@@ -415,13 +238,13 @@ export function openWindow(options: {
|
|
|
415
238
|
},
|
|
416
239
|
height?: number,
|
|
417
240
|
width?: number,
|
|
418
|
-
tab?:
|
|
241
|
+
tab?: Tab,
|
|
419
242
|
doc?: {
|
|
420
243
|
id: string; // 块 id
|
|
421
244
|
},
|
|
422
245
|
}): void;
|
|
423
246
|
|
|
424
|
-
export function openMobileFileById(app: App, id: string, action?:
|
|
247
|
+
export function openMobileFileById(app: App, id: string, action?: TProtyleAction[]): void;
|
|
425
248
|
|
|
426
249
|
export function openTab(options: {
|
|
427
250
|
app: App,
|
|
@@ -438,7 +261,7 @@ export function openTab(options: {
|
|
|
438
261
|
asset?: {
|
|
439
262
|
path: string,
|
|
440
263
|
};
|
|
441
|
-
search?:
|
|
264
|
+
search?: Config.IUILayoutTabSearchConfig;
|
|
442
265
|
card?: {
|
|
443
266
|
type: TCardType,
|
|
444
267
|
id?: string, // cardType 为 all 时不传,否则传文档或笔记本 id
|
|
@@ -454,19 +277,19 @@ export function openTab(options: {
|
|
|
454
277
|
keepCursor?: boolean; // 是否跳转到新 tab 上
|
|
455
278
|
removeCurrentTab?: boolean; // 在当前页签打开时需移除原有页签
|
|
456
279
|
afterOpen?: () => void; // 打开后回调
|
|
457
|
-
}): Promise<
|
|
280
|
+
}): Promise<Tab>
|
|
458
281
|
|
|
459
282
|
export function getFrontend(): "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile";
|
|
460
283
|
|
|
284
|
+
export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios";
|
|
285
|
+
|
|
461
286
|
export function lockScreen(app: App): void
|
|
462
287
|
|
|
463
288
|
export function exitSiYuan(): void
|
|
464
289
|
|
|
465
|
-
export function
|
|
466
|
-
|
|
467
|
-
export function adaptHotkey(hotkey: string): string;
|
|
290
|
+
export function getAllEditor(): Protyle[]
|
|
468
291
|
|
|
469
|
-
export function
|
|
292
|
+
export function getModelByDockType(type: TDock | string): Model | any;
|
|
470
293
|
|
|
471
294
|
/**
|
|
472
295
|
* @param timeout - ms. 0: manual close;-1: always show; 6000: default
|
|
@@ -474,19 +297,14 @@ export function confirm(title: string, text: string, confirmCallback?: (dialog:
|
|
|
474
297
|
*/
|
|
475
298
|
export function showMessage(text: string, timeout?: number, type?: "info" | "error", id?: string): void;
|
|
476
299
|
|
|
477
|
-
export class App {
|
|
478
|
-
plugins: Plugin[];
|
|
479
|
-
appId: string
|
|
480
|
-
}
|
|
481
|
-
|
|
482
300
|
export abstract class Plugin {
|
|
483
301
|
eventBus: EventBus;
|
|
484
|
-
i18n:
|
|
302
|
+
i18n: IObject;
|
|
485
303
|
data: any;
|
|
486
304
|
displayName: string;
|
|
487
305
|
readonly name: string;
|
|
488
306
|
app: App;
|
|
489
|
-
commands:
|
|
307
|
+
commands: ICommand[];
|
|
490
308
|
setting: Setting;
|
|
491
309
|
protyleSlash: {
|
|
492
310
|
filter: string[],
|
|
@@ -494,12 +312,12 @@ export abstract class Plugin {
|
|
|
494
312
|
id: string,
|
|
495
313
|
callback(protyle: Protyle): void,
|
|
496
314
|
}[];
|
|
497
|
-
protyleOptions:
|
|
315
|
+
protyleOptions: IProtyleOptions;
|
|
498
316
|
|
|
499
317
|
constructor(options: {
|
|
500
318
|
app: App,
|
|
501
319
|
name: string,
|
|
502
|
-
i18n:
|
|
320
|
+
i18n: IObject,
|
|
503
321
|
});
|
|
504
322
|
|
|
505
323
|
onload(): void;
|
|
@@ -541,19 +359,19 @@ export abstract class Plugin {
|
|
|
541
359
|
|
|
542
360
|
addIcons(svg: string): void;
|
|
543
361
|
|
|
544
|
-
getOpenedTab(): { [key: string]:
|
|
362
|
+
getOpenedTab(): { [key: string]: Custom[] };
|
|
545
363
|
|
|
546
364
|
/**
|
|
547
365
|
* Must be executed before the synchronous function.
|
|
548
366
|
*/
|
|
549
367
|
addTab(options: {
|
|
550
368
|
type: string,
|
|
551
|
-
beforeDestroy?: (this:
|
|
552
|
-
destroy?: (this:
|
|
553
|
-
resize?: (this:
|
|
554
|
-
update?: (this:
|
|
555
|
-
init: (this:
|
|
556
|
-
}): () =>
|
|
369
|
+
beforeDestroy?: (this: Custom) => void,
|
|
370
|
+
destroy?: (this: Custom) => void,
|
|
371
|
+
resize?: (this: Custom) => void,
|
|
372
|
+
update?: (this: Custom) => void,
|
|
373
|
+
init: (this: Custom) => void,
|
|
374
|
+
}): () => Custom;
|
|
557
375
|
|
|
558
376
|
/**
|
|
559
377
|
* Must be executed before the synchronous function.
|
|
@@ -562,13 +380,13 @@ export abstract class Plugin {
|
|
|
562
380
|
config: IPluginDockTab,
|
|
563
381
|
data: any,
|
|
564
382
|
type: string,
|
|
565
|
-
destroy?: (this:
|
|
566
|
-
resize?: (this:
|
|
567
|
-
update?: (this:
|
|
568
|
-
init: (this:
|
|
569
|
-
}): { config: IPluginDockTab, model:
|
|
383
|
+
destroy?: (this: Dock) => void,
|
|
384
|
+
resize?: (this: Dock) => void,
|
|
385
|
+
update?: (this: Dock) => void,
|
|
386
|
+
init: (this: Dock, dock: Dock) => void,
|
|
387
|
+
}): { config: IPluginDockTab, model: Dock };
|
|
570
388
|
|
|
571
|
-
addCommand(options:
|
|
389
|
+
addCommand(options: ICommand): void;
|
|
572
390
|
|
|
573
391
|
addFloatLayer(options: {
|
|
574
392
|
ids: string[],
|
|
@@ -579,6 +397,8 @@ export abstract class Plugin {
|
|
|
579
397
|
}): void;
|
|
580
398
|
|
|
581
399
|
updateCards(options: ICardData): Promise<ICardData> | ICardData;
|
|
400
|
+
|
|
401
|
+
updateProtyleToolbar(toolbar: Array<string | IMenuItem>) : Array<string | IMenuItem>;
|
|
582
402
|
}
|
|
583
403
|
|
|
584
404
|
export class Setting {
|
|
@@ -648,17 +468,19 @@ export class Dialog {
|
|
|
648
468
|
}
|
|
649
469
|
|
|
650
470
|
export class Menu {
|
|
651
|
-
|
|
652
|
-
|
|
471
|
+
private menu;
|
|
472
|
+
isOpen: boolean;
|
|
653
473
|
element: HTMLElement;
|
|
654
474
|
|
|
475
|
+
constructor(id?: string, closeCB?: () => void);
|
|
476
|
+
|
|
655
477
|
showSubMenu(subMenuElement: HTMLElement): void;
|
|
656
478
|
|
|
657
|
-
addItem(
|
|
479
|
+
addItem(option: IMenu): HTMLElement;
|
|
658
480
|
|
|
659
|
-
addSeparator(index?: number):
|
|
481
|
+
addSeparator(index?: number, ignore?: boolean): HTMLElement;
|
|
660
482
|
|
|
661
|
-
open(options:
|
|
483
|
+
open(options: IPosition): void;
|
|
662
484
|
|
|
663
485
|
/**
|
|
664
486
|
* @param {string} [position=all]
|
|
@@ -667,13 +489,3 @@ export class Menu {
|
|
|
667
489
|
|
|
668
490
|
close(): void;
|
|
669
491
|
}
|
|
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
|
+
}
|