siyuan 0.9.1 → 0.9.2
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 +31 -45
- package/types/protyle.d.ts +61 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.9.
|
|
3
|
+
## 0.9.3 2024-01
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
## 0.9.2 2024-01-09
|
|
7
|
+
|
|
8
|
+
* [Add plugin `protyleOptions`](https://github.com/siyuan-note/siyuan/issues/10090)
|
|
9
|
+
* [Add plugin api `uninstall`](https://github.com/siyuan-note/siyuan/issues/10063)
|
|
10
|
+
* [Add plugin method `updateCards`](https://github.com/siyuan-note/siyuan/issues/10065)
|
|
11
|
+
* [Add plugin function `lockScreen`](https://github.com/siyuan-note/siyuan/issues/10063)
|
|
12
|
+
* [Add plugin event bus `lock-screen`](https://github.com/siyuan-note/siyuan/pull/9967)
|
|
13
|
+
* [Add plugin event bus `open-menu-inbox`](https://github.com/siyuan-note/siyuan/pull/9967)
|
|
14
|
+
|
|
6
15
|
## 0.9.1 2023-12-26
|
|
7
16
|
|
|
8
17
|
* [Set `plugin.name` to read-only](https://github.com/siyuan-note/siyuan/issues/9943)
|
|
@@ -10,7 +19,7 @@
|
|
|
10
19
|
|
|
11
20
|
## 0.9.0 2023-12-05
|
|
12
21
|
|
|
13
|
-
* [Add plugin
|
|
22
|
+
* [Add plugin event bus `sync-start`, `sync-end`, and `sync-fail`](https://github.com/siyuan-note/siyuan/issues/9798)
|
|
14
23
|
* [Add plugin event bus `mobile-keyboard-show` and `mobile-keyboard-hide`](https://github.com/siyuan-note/siyuan/issues/9773)
|
|
15
24
|
* [Add some `Protyle` methods to the plugin API](https://github.com/siyuan-note/petal/issues/21)
|
|
16
25
|
|
package/package.json
CHANGED
package/siyuan.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./types";
|
|
2
2
|
|
|
3
|
-
import {IProtyle, Lute, Protyle, Toolbar} from "./types/protyle";
|
|
3
|
+
import {IProtyle, Lute, Protyle, Toolbar, IProtyleOption} from "./types/protyle";
|
|
4
4
|
import {IMenuBaseDetail} from "./types/events";
|
|
5
5
|
import {IGetDocInfo, IGetTreeStat} from "./types/response";
|
|
6
6
|
|
|
@@ -19,21 +19,6 @@ export type TTurnInto = "Blocks2Ps" | "Blocks2Hs"
|
|
|
19
19
|
|
|
20
20
|
export type TCardType = "doc" | "notebook" | "all"
|
|
21
21
|
|
|
22
|
-
export type TProtyleAction = "cb-get-append" | // 向下滚动加载
|
|
23
|
-
"cb-get-before" | // 向上滚动加载
|
|
24
|
-
"cb-get-unchangeid" | // 上下滚动,定位时不修改 blockid
|
|
25
|
-
"cb-get-hl" | // 高亮
|
|
26
|
-
"cb-get-focus" | // 光标定位
|
|
27
|
-
"cb-get-focusfirst" | // 动态定位到第一个块
|
|
28
|
-
"cb-get-setid" | // 重置 blockid
|
|
29
|
-
"cb-get-all" | // 获取所有块
|
|
30
|
-
"cb-get-backlink" | // 悬浮窗为传递型需展示上下文
|
|
31
|
-
"cb-get-unundo" | // 不需要记录历史
|
|
32
|
-
"cb-get-scroll" | // 滚动到指定位置
|
|
33
|
-
"cb-get-context" | // 包含上下文
|
|
34
|
-
"cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
|
|
35
|
-
"cb-get-history" // 历史渲染
|
|
36
|
-
|
|
37
22
|
export type TOperation =
|
|
38
23
|
"insert"
|
|
39
24
|
| "update"
|
|
@@ -169,6 +154,11 @@ export interface IEventBusMap {
|
|
|
169
154
|
elements: NodeListOf<HTMLElement>,
|
|
170
155
|
type: "doc" | "docs" | "notebook",
|
|
171
156
|
};
|
|
157
|
+
"open-menu-inbox": {
|
|
158
|
+
menu: EventMenu,
|
|
159
|
+
element: HTMLElement,
|
|
160
|
+
ids: string[],
|
|
161
|
+
};
|
|
172
162
|
"open-noneditableblock": {
|
|
173
163
|
protyle: IProtyle,
|
|
174
164
|
toolbar: Toolbar,
|
|
@@ -194,6 +184,7 @@ export interface IEventBusMap {
|
|
|
194
184
|
"sync-start": IWebSocketData;
|
|
195
185
|
"sync-end": IWebSocketData;
|
|
196
186
|
"sync-fail": IWebSocketData;
|
|
187
|
+
"lock-screen": void;
|
|
197
188
|
"mobile-keyboard-show": void;
|
|
198
189
|
"mobile-keyboard-hide": void;
|
|
199
190
|
}
|
|
@@ -362,38 +353,11 @@ export interface ICommandOption {
|
|
|
362
353
|
dockCallback?: (element: HTMLElement) => void // 焦点在 dock 上时执行的回调
|
|
363
354
|
}
|
|
364
355
|
|
|
365
|
-
export interface IProtyleOption {
|
|
366
|
-
action?: TProtyleAction[];
|
|
367
|
-
mode?: "preview" | "wysiwyg";
|
|
368
|
-
blockId: string;
|
|
369
|
-
key?: string;
|
|
370
|
-
scrollAttr?: {
|
|
371
|
-
rootId: string,
|
|
372
|
-
startId: string,
|
|
373
|
-
endId: string,
|
|
374
|
-
scrollTop: number,
|
|
375
|
-
focusId?: string,
|
|
376
|
-
focusStart?: number,
|
|
377
|
-
focusEnd?: number,
|
|
378
|
-
zoomInId?: string,
|
|
379
|
-
};
|
|
380
|
-
defId?: string;
|
|
381
|
-
render?: {
|
|
382
|
-
background?: boolean,
|
|
383
|
-
title?: boolean,
|
|
384
|
-
gutter?: boolean,
|
|
385
|
-
scroll?: boolean,
|
|
386
|
-
breadcrumb?: boolean,
|
|
387
|
-
breadcrumbDocName?: boolean,
|
|
388
|
-
};
|
|
389
|
-
typewriterMode?: boolean;
|
|
390
|
-
|
|
391
|
-
after?(protyle: Protyle): void;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
356
|
export interface IOperation {
|
|
395
357
|
action: TOperation; // move, delete 不需要传 data
|
|
396
358
|
id?: string;
|
|
359
|
+
isTwoWay?: boolean; // 是否双向关联
|
|
360
|
+
backRelationKeyID?: string; // 双向关联的目标关联列 ID
|
|
397
361
|
avID?: string; // av
|
|
398
362
|
format?: string; // updateAttrViewColNumberFormat 专享
|
|
399
363
|
keyID?: string; // updateAttrViewCell 专享
|
|
@@ -403,6 +367,7 @@ export interface IOperation {
|
|
|
403
367
|
previousID?: string;
|
|
404
368
|
retData?: any;
|
|
405
369
|
nextID?: string; // insert 专享
|
|
370
|
+
isDetached?: boolean; // insertAttrViewBlock 专享
|
|
406
371
|
srcIDs?: string[]; // insertAttrViewBlock 专享
|
|
407
372
|
name?: string; // addAttrViewCol 专享
|
|
408
373
|
type?: TAVCol; // addAttrViewCol 专享
|
|
@@ -410,6 +375,20 @@ export interface IOperation {
|
|
|
410
375
|
blockIDs?: string[]; // add/removeFlashcards 专享
|
|
411
376
|
}
|
|
412
377
|
|
|
378
|
+
export interface ICard {
|
|
379
|
+
deckID: string
|
|
380
|
+
cardID: string
|
|
381
|
+
blockID: string
|
|
382
|
+
nextDues: IObject
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface ICardData {
|
|
386
|
+
cards: ICard[],
|
|
387
|
+
unreviewedCount: number
|
|
388
|
+
unreviewedNewCardCount: number
|
|
389
|
+
unreviewedOldCardCount: number
|
|
390
|
+
}
|
|
391
|
+
|
|
413
392
|
export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
|
|
414
393
|
|
|
415
394
|
export function fetchSyncPost(url: string, data?: any): Promise<IWebSocketData>;
|
|
@@ -466,6 +445,8 @@ export function openTab(options: {
|
|
|
466
445
|
|
|
467
446
|
export function getFrontend(): "desktop" | "desktop-window" | "mobile" | "browser-desktop" | "browser-mobile";
|
|
468
447
|
|
|
448
|
+
export function lockScreen(app: App): void
|
|
449
|
+
|
|
469
450
|
export function getBackend(): "windows" | "linux" | "darwin" | "docker" | "android" | "ios";
|
|
470
451
|
|
|
471
452
|
export function adaptHotkey(hotkey: string): string;
|
|
@@ -498,6 +479,7 @@ export abstract class Plugin {
|
|
|
498
479
|
id: string,
|
|
499
480
|
callback(protyle: Protyle): void,
|
|
500
481
|
}[];
|
|
482
|
+
protyleOptions: IProtyleOption;
|
|
501
483
|
|
|
502
484
|
constructor(options: {
|
|
503
485
|
app: App,
|
|
@@ -509,6 +491,8 @@ export abstract class Plugin {
|
|
|
509
491
|
|
|
510
492
|
onunload(): void;
|
|
511
493
|
|
|
494
|
+
uninstall(): void;
|
|
495
|
+
|
|
512
496
|
onLayoutReady(): void;
|
|
513
497
|
|
|
514
498
|
/**
|
|
@@ -578,6 +562,8 @@ export abstract class Plugin {
|
|
|
578
562
|
y?: number,
|
|
579
563
|
targetElement?: HTMLElement
|
|
580
564
|
}): void;
|
|
565
|
+
|
|
566
|
+
updateCards(options: ICardData): Promise<ICardData> | ICardData;
|
|
581
567
|
}
|
|
582
568
|
|
|
583
569
|
export class Setting {
|
package/types/protyle.d.ts
CHANGED
|
@@ -4,11 +4,70 @@ import {
|
|
|
4
4
|
IObject,
|
|
5
5
|
IOperation,
|
|
6
6
|
IPosition,
|
|
7
|
-
|
|
7
|
+
TTurnInto,
|
|
8
8
|
TTurnIntoOne,
|
|
9
9
|
TTurnIntoOneSub
|
|
10
10
|
} from "./../siyuan";
|
|
11
11
|
|
|
12
|
+
type TProtyleAction = "cb-get-append" | // 向下滚动加载
|
|
13
|
+
"cb-get-before" | // 向上滚动加载
|
|
14
|
+
"cb-get-unchangeid" | // 上下滚动,定位时不修改 blockid
|
|
15
|
+
"cb-get-hl" | // 高亮
|
|
16
|
+
"cb-get-focus" | // 光标定位
|
|
17
|
+
"cb-get-focusfirst" | // 动态定位到第一个块
|
|
18
|
+
"cb-get-setid" | // 重置 blockid
|
|
19
|
+
"cb-get-all" | // 获取所有块
|
|
20
|
+
"cb-get-backlink" | // 悬浮窗为传递型需展示上下文
|
|
21
|
+
"cb-get-unundo" | // 不需要记录历史
|
|
22
|
+
"cb-get-scroll" | // 滚动到指定位置
|
|
23
|
+
"cb-get-context" | // 包含上下文
|
|
24
|
+
"cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
|
|
25
|
+
"cb-get-history" // 历史渲染
|
|
26
|
+
|
|
27
|
+
interface IToolbarItem {
|
|
28
|
+
/** 唯一标示 */
|
|
29
|
+
name: string;
|
|
30
|
+
/** 提示 */
|
|
31
|
+
tip?: string;
|
|
32
|
+
/** svg 图标 */
|
|
33
|
+
icon: string;
|
|
34
|
+
/** 快捷键 */
|
|
35
|
+
hotkey?: string;
|
|
36
|
+
/** 提示位置 */
|
|
37
|
+
tipPosition: string;
|
|
38
|
+
click?(protyle: Protyle): void;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface IProtyleOption {
|
|
42
|
+
action?: TProtyleAction[];
|
|
43
|
+
mode?: "preview" | "wysiwyg";
|
|
44
|
+
toolbar?: Array<string | IToolbarItem>;
|
|
45
|
+
blockId?: string;
|
|
46
|
+
key?: string;
|
|
47
|
+
scrollAttr?: {
|
|
48
|
+
rootId: string,
|
|
49
|
+
startId: string,
|
|
50
|
+
endId: string,
|
|
51
|
+
scrollTop: number,
|
|
52
|
+
focusId?: string,
|
|
53
|
+
focusStart?: number,
|
|
54
|
+
focusEnd?: number,
|
|
55
|
+
zoomInId?: string,
|
|
56
|
+
};
|
|
57
|
+
defId?: string;
|
|
58
|
+
render?: {
|
|
59
|
+
background?: boolean,
|
|
60
|
+
title?: boolean,
|
|
61
|
+
gutter?: boolean,
|
|
62
|
+
scroll?: boolean,
|
|
63
|
+
breadcrumb?: boolean,
|
|
64
|
+
breadcrumbDocName?: boolean,
|
|
65
|
+
};
|
|
66
|
+
typewriterMode?: boolean;
|
|
67
|
+
|
|
68
|
+
after?(protyle: Protyle): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
12
71
|
// REF: https://github.com/siyuan-note/siyuan/blob/dev/app/src/types/protyle.d.ts
|
|
13
72
|
export interface IProtyle {
|
|
14
73
|
app: App;
|
|
@@ -54,7 +113,7 @@ export interface IProtyle {
|
|
|
54
113
|
contentElement?: HTMLElement;
|
|
55
114
|
options: any;
|
|
56
115
|
lute?: Lute;
|
|
57
|
-
toolbar?:
|
|
116
|
+
toolbar?: Toolbar;
|
|
58
117
|
preview?: any;
|
|
59
118
|
hint?: any;
|
|
60
119
|
upload?: any;
|