siyuan 0.8.4 → 0.8.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 +5 -1
- package/package.json +1 -1
- package/siyuan.d.ts +83 -147
- package/types/events.d.ts +5 -234
- package/types/protyle.d.ts +160 -1
- package/types/response.d.ts +20 -0
- package/types/index.d.ts +0 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/siyuan.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import {IProtyle, Lute, Protyle, Toolbar} from "./types/protyle";
|
|
2
|
+
import {IMenuBaseDetail} from "./types/events";
|
|
3
|
+
import {IGetDocInfo, IGetTreeStat} from "./types/response";
|
|
3
4
|
|
|
4
5
|
declare global {
|
|
5
6
|
interface Window extends Global {
|
|
@@ -75,26 +76,75 @@ interface Global {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
interface IEventBusMap {
|
|
78
|
-
"click-blockicon":
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"
|
|
97
|
-
|
|
79
|
+
"click-blockicon": {
|
|
80
|
+
protyle: IProtyle,
|
|
81
|
+
blockElements: HTMLElement[]
|
|
82
|
+
};
|
|
83
|
+
"click-editorcontent": {
|
|
84
|
+
protyle: IProtyle,
|
|
85
|
+
event: MouseEvent
|
|
86
|
+
};
|
|
87
|
+
"click-editortitleicon": {
|
|
88
|
+
protyle: IProtyle,
|
|
89
|
+
data: IGetDocInfo,
|
|
90
|
+
};
|
|
91
|
+
"click-pdf": {
|
|
92
|
+
event: MouseEvent
|
|
93
|
+
};
|
|
94
|
+
"destroy-protyle": {
|
|
95
|
+
protyle: IProtyle
|
|
96
|
+
};
|
|
97
|
+
"input-search": {
|
|
98
|
+
protyle: Protyle,
|
|
99
|
+
config: ISearchOption,
|
|
100
|
+
searchElement: HTMLInputElement,
|
|
101
|
+
};
|
|
102
|
+
"loaded-protyle-dynamic": {
|
|
103
|
+
protyle: IProtyle,
|
|
104
|
+
positon: "afterend" | "beforebegin"
|
|
105
|
+
};
|
|
106
|
+
"loaded-protyle": {
|
|
107
|
+
protyle: IProtyle,
|
|
108
|
+
};
|
|
109
|
+
"open-menu-av": IMenuBaseDetail;
|
|
110
|
+
"open-menu-blockref": IMenuBaseDetail;
|
|
111
|
+
"open-menu-breadcrumbmore": {
|
|
112
|
+
menu: EventMenu,
|
|
113
|
+
protyle: IProtyle,
|
|
114
|
+
data: IGetTreeStat,
|
|
115
|
+
};
|
|
116
|
+
"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-doctree": {
|
|
122
|
+
menu: EventMenu,
|
|
123
|
+
elements: NodeListOf<Element>,
|
|
124
|
+
type: "doc" | "docs" | "notebook"
|
|
125
|
+
};
|
|
126
|
+
"open-noneditableblock": {
|
|
127
|
+
protyle: IProtyle,
|
|
128
|
+
toolbar: Toolbar
|
|
129
|
+
};
|
|
130
|
+
"open-siyuan-url-block": {
|
|
131
|
+
url: string,
|
|
132
|
+
id: string,
|
|
133
|
+
focus: boolean,
|
|
134
|
+
exist: boolean,
|
|
135
|
+
};
|
|
136
|
+
"open-siyuan-url-plugin": {
|
|
137
|
+
url: string
|
|
138
|
+
}
|
|
139
|
+
"ws-main": IWebSocketData;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface IPosition {
|
|
143
|
+
x: number,
|
|
144
|
+
y: number,
|
|
145
|
+
w?: number,
|
|
146
|
+
h?: number,
|
|
147
|
+
isLeft?: boolean
|
|
98
148
|
}
|
|
99
149
|
|
|
100
150
|
interface ITab {
|
|
@@ -164,6 +214,9 @@ interface ILuteNode {
|
|
|
164
214
|
|
|
165
215
|
interface ISearchOption {
|
|
166
216
|
page?: number
|
|
217
|
+
removed?: boolean // 移除后需记录搜索内容 https://github.com/siyuan-note/siyuan/issues/7745
|
|
218
|
+
name?: string
|
|
219
|
+
sort?: number, // 0:按块类型(默认),1:按创建时间升序,2:按创建时间降序,3:按更新时间升序,4:按更新时间降序,5:按内容顺序(仅在按文档分组时),6:按相关度升序,7:按相关度降序
|
|
167
220
|
group?: number, // 0:不分组,1:按文档分组
|
|
168
221
|
hasReplace?: boolean,
|
|
169
222
|
method?: number // 0:文本,1:查询语法,2:SQL,3:正则表达式
|
|
@@ -184,6 +237,7 @@ interface ISearchOption {
|
|
|
184
237
|
codeBlock: boolean
|
|
185
238
|
htmlBlock: boolean
|
|
186
239
|
embedBlock: boolean
|
|
240
|
+
databaseBlock: boolean
|
|
187
241
|
}
|
|
188
242
|
}
|
|
189
243
|
|
|
@@ -207,8 +261,9 @@ interface IPluginDockTab {
|
|
|
207
261
|
}
|
|
208
262
|
|
|
209
263
|
interface IMenuItemOption {
|
|
264
|
+
iconClass?: string,
|
|
210
265
|
label?: string,
|
|
211
|
-
click?: (element: HTMLElement) => void
|
|
266
|
+
click?: (element: HTMLElement, event: MouseEvent) => boolean | void | Promise<boolean | void>
|
|
212
267
|
type?: "separator" | "submenu" | "readonly",
|
|
213
268
|
accelerator?: string,
|
|
214
269
|
action?: string,
|
|
@@ -460,29 +515,6 @@ export abstract class Plugin {
|
|
|
460
515
|
}): void
|
|
461
516
|
}
|
|
462
517
|
|
|
463
|
-
export class Protyle {
|
|
464
|
-
|
|
465
|
-
public protyle: any;
|
|
466
|
-
|
|
467
|
-
constructor(app: App, element: HTMLElement, options?: IProtyleOption)
|
|
468
|
-
|
|
469
|
-
isUploading(): boolean
|
|
470
|
-
|
|
471
|
-
destroy(): void
|
|
472
|
-
|
|
473
|
-
resize(): void
|
|
474
|
-
|
|
475
|
-
reload(focus: boolean): void
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* @param {boolean} [isBlock=false]
|
|
479
|
-
* @param {boolean} [useProtyleRange=false]
|
|
480
|
-
*/
|
|
481
|
-
insert(html: string, isBlock?: boolean, useProtyleRange?: boolean): void
|
|
482
|
-
|
|
483
|
-
transaction(doOperations: IOperation[], undoOperations?: IOperation[]): void;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
518
|
export class Setting {
|
|
487
519
|
constructor(options: {
|
|
488
520
|
height?: string,
|
|
@@ -564,108 +596,12 @@ export class Menu {
|
|
|
564
596
|
close(): void;
|
|
565
597
|
}
|
|
566
598
|
|
|
567
|
-
export class
|
|
568
|
-
public
|
|
569
|
-
public static WalkSkipChildren: number;
|
|
570
|
-
public static WalkContinue: number;
|
|
571
|
-
public static Version: string;
|
|
572
|
-
public static Caret: string;
|
|
573
|
-
|
|
574
|
-
public static New(): Lute;
|
|
575
|
-
|
|
576
|
-
public static EChartsMindmapStr(text: string): string;
|
|
577
|
-
|
|
578
|
-
public static NewNodeID(): string;
|
|
579
|
-
|
|
580
|
-
public static Sanitize(html: string): string;
|
|
581
|
-
|
|
582
|
-
public static EscapeHTMLStr(str: string): string;
|
|
583
|
-
|
|
584
|
-
public static UnEscapeHTMLStr(str: string): string;
|
|
585
|
-
|
|
586
|
-
public static GetHeadingID(node: ILuteNode): string;
|
|
587
|
-
|
|
588
|
-
public static BlockDOM2Content(html: string): string;
|
|
589
|
-
|
|
590
|
-
private constructor();
|
|
591
|
-
|
|
592
|
-
public BlockDOM2Content(text: string): string;
|
|
593
|
-
|
|
594
|
-
public BlockDOM2EscapeMarkerContent(text: string): string;
|
|
595
|
-
|
|
596
|
-
public SetTextMark(enable: boolean): void;
|
|
597
|
-
|
|
598
|
-
public SetHeadingID(enable: boolean): void;
|
|
599
|
-
|
|
600
|
-
public SetProtyleMarkNetImg(enable: boolean): void;
|
|
601
|
-
|
|
602
|
-
public SetSpellcheck(enable: boolean): void;
|
|
603
|
-
|
|
604
|
-
public SetFileAnnotationRef(enable: boolean): void;
|
|
605
|
-
|
|
606
|
-
public SetSetext(enable: boolean): void;
|
|
607
|
-
|
|
608
|
-
public SetYamlFrontMatter(enable: boolean): void;
|
|
609
|
-
|
|
610
|
-
public SetChineseParagraphBeginningSpace(enable: boolean): void;
|
|
611
|
-
|
|
612
|
-
public SetRenderListStyle(enable: boolean): void;
|
|
613
|
-
|
|
614
|
-
public SetImgPathAllowSpace(enable: boolean): void;
|
|
615
|
-
|
|
616
|
-
public SetKramdownIAL(enable: boolean): void;
|
|
617
|
-
|
|
618
|
-
public BlockDOM2Md(html: string): string;
|
|
619
|
-
|
|
620
|
-
public BlockDOM2StdMd(html: string): string;
|
|
621
|
-
|
|
622
|
-
public SetGitConflict(enable: boolean): void;
|
|
623
|
-
|
|
624
|
-
public SetSuperBlock(enable: boolean): void;
|
|
625
|
-
|
|
626
|
-
public SetTag(enable: boolean): void;
|
|
627
|
-
|
|
628
|
-
public SetMark(enable: boolean): void;
|
|
629
|
-
|
|
630
|
-
public SetSub(enable: boolean): void;
|
|
631
|
-
|
|
632
|
-
public SetSup(enable: boolean): void;
|
|
633
|
-
|
|
634
|
-
public SetBlockRef(enable: boolean): void;
|
|
635
|
-
|
|
636
|
-
public SetSanitize(enable: boolean): void;
|
|
637
|
-
|
|
638
|
-
public SetHeadingAnchor(enable: boolean): void;
|
|
639
|
-
|
|
640
|
-
public SetImageLazyLoading(imagePath: string): void;
|
|
641
|
-
|
|
642
|
-
public SetInlineMathAllowDigitAfterOpenMarker(enable: boolean): void;
|
|
643
|
-
|
|
644
|
-
public SetToC(enable: boolean): void;
|
|
645
|
-
|
|
646
|
-
public SetIndentCodeBlock(enable: boolean): void;
|
|
647
|
-
|
|
648
|
-
public SetParagraphBeginningSpace(enable: boolean): void;
|
|
649
|
-
|
|
650
|
-
public SetFootnotes(enable: boolean): void;
|
|
651
|
-
|
|
652
|
-
public SetLinkRef(enalbe: boolean): void;
|
|
653
|
-
|
|
654
|
-
public SetEmojiSite(emojiSite: string): void;
|
|
655
|
-
|
|
656
|
-
public PutEmojis(emojis: IObject): void;
|
|
657
|
-
|
|
658
|
-
public SpinBlockDOM(html: string): string;
|
|
659
|
-
|
|
660
|
-
public Md2BlockDOM(html: string): string;
|
|
661
|
-
|
|
662
|
-
public SetProtyleWYSIWYG(wysiwyg: boolean): void;
|
|
663
|
-
|
|
664
|
-
public MarkdownStr(name: string, md: string): string;
|
|
599
|
+
export class EventMenu {
|
|
600
|
+
public menus: IMenuItemOption[];
|
|
665
601
|
|
|
666
|
-
|
|
602
|
+
constructor()
|
|
667
603
|
|
|
668
|
-
public
|
|
604
|
+
public addSeparator(index?: number): void
|
|
669
605
|
|
|
670
|
-
public
|
|
606
|
+
public addItem(menu: IMenuItemOption): void
|
|
671
607
|
}
|
package/types/events.d.ts
CHANGED
|
@@ -1,237 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type {IProtyle} from "./protyle";
|
|
2
|
+
import {EventMenu} from "./../siyuan";
|
|
3
3
|
|
|
4
|
-
//#region click-block-icon
|
|
5
|
-
interface IBlockIconDetail {
|
|
6
|
-
menu: InstanceType<typeof Menu>;
|
|
7
|
-
protyle: IProtyle;
|
|
8
|
-
data?: IDocumentData;
|
|
9
|
-
blockElements?: HTMLElement[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface IDocumentData {
|
|
13
|
-
id: string;
|
|
14
|
-
ial: Record<string, string>;
|
|
15
|
-
icon: string;
|
|
16
|
-
name: string;
|
|
17
|
-
rootID: string;
|
|
18
|
-
refIDs: string[];
|
|
19
|
-
refCount: number;
|
|
20
|
-
subFileCount: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* `click-blockicon`
|
|
25
|
-
*/
|
|
26
|
-
export interface IClickBlockIconDetail extends IBlockIconDetail {
|
|
27
|
-
blockElements: HTMLElement[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* `click-editortitleicon`
|
|
32
|
-
*/
|
|
33
|
-
export interface IClickEditorTitleIconDetail extends IBlockIconDetail {
|
|
34
|
-
data: IDocumentData;
|
|
35
|
-
}
|
|
36
|
-
//#endregion click-block-icon
|
|
37
|
-
|
|
38
|
-
//#region click-editor-content
|
|
39
|
-
/**
|
|
40
|
-
* `click-editorcontent`
|
|
41
|
-
*/
|
|
42
|
-
export interface IClickEditorContentDetail {
|
|
43
|
-
event: PointerEvent;
|
|
44
|
-
protyle: IProtyle;
|
|
45
|
-
}
|
|
46
|
-
//#endregion click-editor-content
|
|
47
|
-
|
|
48
|
-
//#region click-pdf
|
|
49
|
-
/**
|
|
50
|
-
* `click-pdf`
|
|
51
|
-
*/
|
|
52
|
-
export interface IClickPdfDetail {
|
|
53
|
-
event: PointerEvent;
|
|
54
|
-
}
|
|
55
|
-
//#endregion click-pdf
|
|
56
|
-
|
|
57
|
-
//#region protyle
|
|
58
|
-
/**
|
|
59
|
-
* `loaded-protyle`
|
|
60
|
-
*/
|
|
61
|
-
export interface ILoadedProtyleDetail extends IProtyle {
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* `loaded-protyle-dynamic`
|
|
66
|
-
*/
|
|
67
|
-
export interface ILoadedProtyleDynamicDetail {
|
|
68
|
-
protyle: IProtyle;
|
|
69
|
-
positon: string;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* `destroy-protyle`
|
|
74
|
-
*/
|
|
75
|
-
export interface IDestroyProtyleDetail {
|
|
76
|
-
protyle: IProtyle;
|
|
77
|
-
}
|
|
78
|
-
//#endregion protyle
|
|
79
|
-
|
|
80
|
-
//#region input-search
|
|
81
|
-
interface IInputSearchConfig {
|
|
82
|
-
removed: boolean;
|
|
83
|
-
k: string;
|
|
84
|
-
r: string;
|
|
85
|
-
hasReplace: boolean;
|
|
86
|
-
method: number;
|
|
87
|
-
hPath: string;
|
|
88
|
-
idPath: string[];
|
|
89
|
-
group: number;
|
|
90
|
-
sort: number;
|
|
91
|
-
types: {
|
|
92
|
-
blockquote: boolean;
|
|
93
|
-
codeBlock: boolean;
|
|
94
|
-
document: boolean;
|
|
95
|
-
embedBlock: boolean;
|
|
96
|
-
heading: boolean;
|
|
97
|
-
htmlBlock: boolean;
|
|
98
|
-
list: boolean;
|
|
99
|
-
listItem: boolean;
|
|
100
|
-
mathBlock: boolean;
|
|
101
|
-
paragraph: boolean;
|
|
102
|
-
superBlock: boolean;
|
|
103
|
-
table: boolean;
|
|
104
|
-
};
|
|
105
|
-
page: number;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
interface IInputSearchProtyle {
|
|
109
|
-
protyle: IProtyle;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* `input-search`
|
|
114
|
-
*/
|
|
115
|
-
export interface IInputSearchDetail {
|
|
116
|
-
config: IInputSearchConfig;
|
|
117
|
-
protyle: IInputSearchProtyle;
|
|
118
|
-
searchElement: HTMLInputElement;
|
|
119
|
-
}
|
|
120
|
-
//#endregion input-search
|
|
121
|
-
|
|
122
|
-
//#region open-menu
|
|
123
4
|
interface IMenuBaseDetail {
|
|
124
|
-
menu:
|
|
125
|
-
protyle: IProtyle
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
interface IMenuInlineDetail extends IMenuBaseDetail {
|
|
129
|
-
element: HTMLSpanElement,
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
interface IBreadcrumbData {
|
|
133
|
-
imageCount: number;
|
|
134
|
-
linkCount: number;
|
|
135
|
-
refCount: number;
|
|
136
|
-
runeCount: number;
|
|
137
|
-
wordCount: number;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* `open-menu-breadcrumbmore`
|
|
142
|
-
*/
|
|
143
|
-
export interface IOpenMenuBreadcrumbMoreDetail extends IMenuBaseDetail {
|
|
144
|
-
data: IBreadcrumbData;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* `open-menu-content`
|
|
149
|
-
*/
|
|
150
|
-
export interface IOpenMenuContentDetail extends IMenuBaseDetail {
|
|
151
|
-
element: HTMLDivElement,
|
|
152
|
-
range: Range;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* `open-menu-blockref`
|
|
157
|
-
*/
|
|
158
|
-
export interface IOpenMenuBlockRefDetail extends IMenuInlineDetail {
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* `open-menu-fileannotationref`
|
|
163
|
-
*/
|
|
164
|
-
export interface IOpenMenuFileAnnotationRefDetail extends IMenuInlineDetail {
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* `open-menu-image`
|
|
169
|
-
*/
|
|
170
|
-
export interface IOpenMenuImageDetail extends IMenuInlineDetail {
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* `open-menu-link`
|
|
175
|
-
*/
|
|
176
|
-
export interface IOpenMenuLinkDetail extends IMenuInlineDetail {
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* `open-menu-tag`
|
|
181
|
-
*/
|
|
182
|
-
export interface IOpenMenuTagDetail extends IMenuInlineDetail {
|
|
183
|
-
}
|
|
184
|
-
//#endregion open-menu
|
|
185
|
-
|
|
186
|
-
//#region open-noneditableblock
|
|
187
|
-
interface INonEditableBlockToolbar {
|
|
188
|
-
element: HTMLDivElement;
|
|
189
|
-
range: Range;
|
|
190
|
-
subElement: HTMLDivElement;
|
|
191
|
-
subElementCloseCB: () => any;
|
|
192
|
-
toolbarHeight: number;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* `open-noneditableblock`
|
|
197
|
-
*/
|
|
198
|
-
export interface IOpenNonEditableBlockDetail {
|
|
199
|
-
protyle: IProtyle;
|
|
200
|
-
toolbar: INonEditableBlockToolbar;
|
|
201
|
-
}
|
|
202
|
-
//#endregion open-noneditableblock
|
|
203
|
-
|
|
204
|
-
//#region open-siyuan-url
|
|
205
|
-
interface IOpenSiyuanUrlDetail {
|
|
206
|
-
url: string;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* `open-siyuan-url-block`
|
|
211
|
-
*/
|
|
212
|
-
export interface IOpenSiyuanUrlBlockDetail extends IOpenSiyuanUrlDetail {
|
|
213
|
-
id: string;
|
|
214
|
-
focus: boolean;
|
|
215
|
-
exist: boolean;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* `open-siyuan-url-plugin`
|
|
220
|
-
*/
|
|
221
|
-
export interface IOpenSiyuanUrlPluginDetail extends IOpenSiyuanUrlDetail {
|
|
222
|
-
}
|
|
223
|
-
//#endregion open-siyuan-url
|
|
224
|
-
|
|
225
|
-
//#region ws-main
|
|
226
|
-
/**
|
|
227
|
-
* `ws-main`
|
|
228
|
-
*/
|
|
229
|
-
export interface IWebSocketMainDetail {
|
|
230
|
-
cmd?: string
|
|
231
|
-
callback?: string
|
|
232
|
-
data?: any
|
|
233
|
-
msg: string
|
|
234
|
-
code: number
|
|
235
|
-
sid?: string
|
|
5
|
+
menu: EventMenu,
|
|
6
|
+
protyle: IProtyle,
|
|
7
|
+
element: HTMLElement,
|
|
236
8
|
}
|
|
237
|
-
//#endregion ws-main
|
package/types/protyle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {App,
|
|
1
|
+
import {App, ILuteNode, IObject, IOperation, IPosition, IProtyleOption} from "./../siyuan";
|
|
2
2
|
|
|
3
3
|
// REF: https://github.com/siyuan-note/siyuan/blob/dev/app/src/types/protyle.d.ts
|
|
4
4
|
export interface IProtyle {
|
|
@@ -52,3 +52,162 @@ export interface IProtyle {
|
|
|
52
52
|
undo?: any;
|
|
53
53
|
wysiwyg?: any;
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
export class Protyle {
|
|
57
|
+
|
|
58
|
+
public protyle: IProtyle;
|
|
59
|
+
|
|
60
|
+
constructor(app: App, element: HTMLElement, options?: IProtyleOption)
|
|
61
|
+
|
|
62
|
+
isUploading(): boolean
|
|
63
|
+
|
|
64
|
+
destroy(): void
|
|
65
|
+
|
|
66
|
+
resize(): void
|
|
67
|
+
|
|
68
|
+
reload(focus: boolean): void
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {boolean} [isBlock=false]
|
|
72
|
+
* @param {boolean} [useProtyleRange=false]
|
|
73
|
+
*/
|
|
74
|
+
insert(html: string, isBlock?: boolean, useProtyleRange?: boolean): void
|
|
75
|
+
|
|
76
|
+
transaction(doOperations: IOperation[], undoOperations?: IOperation[]): void;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export class Toolbar {
|
|
80
|
+
public element: HTMLElement;
|
|
81
|
+
public subElement: HTMLElement;
|
|
82
|
+
public subElementCloseCB: () => void;
|
|
83
|
+
public range: Range;
|
|
84
|
+
|
|
85
|
+
constructor(protyle: IProtyle)
|
|
86
|
+
|
|
87
|
+
public render(protyle: IProtyle, range: Range, event?: KeyboardEvent)
|
|
88
|
+
|
|
89
|
+
public showContent(protyle: IProtyle, range: Range, nodeElement: Element)
|
|
90
|
+
|
|
91
|
+
public showWidget(protyle: IProtyle, nodeElement: HTMLElement, range: Range)
|
|
92
|
+
|
|
93
|
+
public showTpl(protyle: IProtyle, nodeElement: HTMLElement, range: Range)
|
|
94
|
+
|
|
95
|
+
public showCodeLanguage(protyle: IProtyle, languageElement: HTMLElement)
|
|
96
|
+
|
|
97
|
+
public showRender(protyle: IProtyle, renderElement: Element, updateElements?: Element[], oldHTML?: string)
|
|
98
|
+
|
|
99
|
+
public setInlineMark(protyle: IProtyle, type: string, action: "range" | "toolbar", textObj?: {
|
|
100
|
+
color?: string,
|
|
101
|
+
type: string
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
public getCurrentType(range: Range): string[]
|
|
105
|
+
|
|
106
|
+
public showAssets(protyle: IProtyle, position: IPosition, avCB?: (url: string) => void)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export class Lute {
|
|
110
|
+
public static WalkStop: number;
|
|
111
|
+
public static WalkSkipChildren: number;
|
|
112
|
+
public static WalkContinue: number;
|
|
113
|
+
public static Version: string;
|
|
114
|
+
public static Caret: string;
|
|
115
|
+
|
|
116
|
+
public static New(): Lute;
|
|
117
|
+
|
|
118
|
+
public static EChartsMindmapStr(text: string): string;
|
|
119
|
+
|
|
120
|
+
public static NewNodeID(): string;
|
|
121
|
+
|
|
122
|
+
public static Sanitize(html: string): string;
|
|
123
|
+
|
|
124
|
+
public static EscapeHTMLStr(str: string): string;
|
|
125
|
+
|
|
126
|
+
public static UnEscapeHTMLStr(str: string): string;
|
|
127
|
+
|
|
128
|
+
public static GetHeadingID(node: ILuteNode): string;
|
|
129
|
+
|
|
130
|
+
public static BlockDOM2Content(html: string): string;
|
|
131
|
+
|
|
132
|
+
private constructor();
|
|
133
|
+
|
|
134
|
+
public BlockDOM2Content(text: string): string;
|
|
135
|
+
|
|
136
|
+
public BlockDOM2EscapeMarkerContent(text: string): string;
|
|
137
|
+
|
|
138
|
+
public SetTextMark(enable: boolean): void;
|
|
139
|
+
|
|
140
|
+
public SetHeadingID(enable: boolean): void;
|
|
141
|
+
|
|
142
|
+
public SetProtyleMarkNetImg(enable: boolean): void;
|
|
143
|
+
|
|
144
|
+
public SetSpellcheck(enable: boolean): void;
|
|
145
|
+
|
|
146
|
+
public SetFileAnnotationRef(enable: boolean): void;
|
|
147
|
+
|
|
148
|
+
public SetSetext(enable: boolean): void;
|
|
149
|
+
|
|
150
|
+
public SetYamlFrontMatter(enable: boolean): void;
|
|
151
|
+
|
|
152
|
+
public SetChineseParagraphBeginningSpace(enable: boolean): void;
|
|
153
|
+
|
|
154
|
+
public SetRenderListStyle(enable: boolean): void;
|
|
155
|
+
|
|
156
|
+
public SetImgPathAllowSpace(enable: boolean): void;
|
|
157
|
+
|
|
158
|
+
public SetKramdownIAL(enable: boolean): void;
|
|
159
|
+
|
|
160
|
+
public BlockDOM2Md(html: string): string;
|
|
161
|
+
|
|
162
|
+
public BlockDOM2StdMd(html: string): string;
|
|
163
|
+
|
|
164
|
+
public SetGitConflict(enable: boolean): void;
|
|
165
|
+
|
|
166
|
+
public SetSuperBlock(enable: boolean): void;
|
|
167
|
+
|
|
168
|
+
public SetTag(enable: boolean): void;
|
|
169
|
+
|
|
170
|
+
public SetMark(enable: boolean): void;
|
|
171
|
+
|
|
172
|
+
public SetSub(enable: boolean): void;
|
|
173
|
+
|
|
174
|
+
public SetSup(enable: boolean): void;
|
|
175
|
+
|
|
176
|
+
public SetBlockRef(enable: boolean): void;
|
|
177
|
+
|
|
178
|
+
public SetSanitize(enable: boolean): void;
|
|
179
|
+
|
|
180
|
+
public SetHeadingAnchor(enable: boolean): void;
|
|
181
|
+
|
|
182
|
+
public SetImageLazyLoading(imagePath: string): void;
|
|
183
|
+
|
|
184
|
+
public SetInlineMathAllowDigitAfterOpenMarker(enable: boolean): void;
|
|
185
|
+
|
|
186
|
+
public SetToC(enable: boolean): void;
|
|
187
|
+
|
|
188
|
+
public SetIndentCodeBlock(enable: boolean): void;
|
|
189
|
+
|
|
190
|
+
public SetParagraphBeginningSpace(enable: boolean): void;
|
|
191
|
+
|
|
192
|
+
public SetFootnotes(enable: boolean): void;
|
|
193
|
+
|
|
194
|
+
public SetLinkRef(enalbe: boolean): void;
|
|
195
|
+
|
|
196
|
+
public SetEmojiSite(emojiSite: string): void;
|
|
197
|
+
|
|
198
|
+
public PutEmojis(emojis: IObject): void;
|
|
199
|
+
|
|
200
|
+
public SpinBlockDOM(html: string): string;
|
|
201
|
+
|
|
202
|
+
public Md2BlockDOM(html: string): string;
|
|
203
|
+
|
|
204
|
+
public SetProtyleWYSIWYG(wysiwyg: boolean): void;
|
|
205
|
+
|
|
206
|
+
public MarkdownStr(name: string, md: string): string;
|
|
207
|
+
|
|
208
|
+
public IsValidLinkDest(text: string): boolean;
|
|
209
|
+
|
|
210
|
+
public BlockDOM2InlineBlockDOM(html: string): string;
|
|
211
|
+
|
|
212
|
+
public BlockDOM2HTML(html: string): string;
|
|
213
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {IObject} from "../siyuan";
|
|
2
|
+
|
|
3
|
+
interface IGetDocInfo {
|
|
4
|
+
ial: IObject
|
|
5
|
+
icon: number
|
|
6
|
+
id: number
|
|
7
|
+
name: number
|
|
8
|
+
refCount: number
|
|
9
|
+
refIDs: string[]
|
|
10
|
+
rootID: string
|
|
11
|
+
subFileCount: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface IGetTreeStat {
|
|
15
|
+
imageCount: number;
|
|
16
|
+
linkCount: number;
|
|
17
|
+
refCount: number;
|
|
18
|
+
runeCount: number;
|
|
19
|
+
wordCount: number;
|
|
20
|
+
}
|
package/types/index.d.ts
DELETED