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/types/protyle.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
App,
|
|
3
|
-
ILuteNode,
|
|
2
|
+
App, Config, Editor,
|
|
4
3
|
IObject,
|
|
5
|
-
IOperation,
|
|
6
|
-
IPosition,
|
|
7
|
-
TTurnInto,
|
|
8
|
-
TTurnIntoOne,
|
|
9
|
-
TTurnIntoOneSub
|
|
4
|
+
IOperation, IPosition, IWebSocketData, Menu,
|
|
10
5
|
} from "./../siyuan";
|
|
6
|
+
import {Model} from "./layout/Model";
|
|
11
7
|
|
|
12
|
-
type
|
|
8
|
+
type TTurnIntoOne = "BlocksMergeSuperBlock" | "Blocks2ULs" | "Blocks2OLs" | "Blocks2TLs" | "Blocks2Blockquote"
|
|
9
|
+
|
|
10
|
+
type TTurnIntoOneSub = "row" | "col"
|
|
11
|
+
|
|
12
|
+
type TTurnInto = "Blocks2Ps" | "Blocks2Hs"
|
|
13
|
+
|
|
14
|
+
type THintSource = "search" | "av" | "hint";
|
|
15
|
+
|
|
16
|
+
export type TProtyleAction = "cb-get-append" | // 向下滚动加载
|
|
13
17
|
"cb-get-before" | // 向上滚动加载
|
|
14
18
|
"cb-get-unchangeid" | // 上下滚动,定位时不修改 blockid
|
|
15
19
|
"cb-get-hl" | // 高亮
|
|
@@ -19,189 +23,404 @@ type TProtyleAction = "cb-get-append" | // 向下滚动加载
|
|
|
19
23
|
"cb-get-all" | // 获取所有块
|
|
20
24
|
"cb-get-backlink" | // 悬浮窗为传递型需展示上下文
|
|
21
25
|
"cb-get-unundo" | // 不需要记录历史
|
|
22
|
-
"cb-get-scroll" | //
|
|
26
|
+
"cb-get-scroll" | // 滚动到指定位置,用于直接打开文档,必有 rootID
|
|
23
27
|
"cb-get-context" | // 包含上下文
|
|
28
|
+
"cb-get-rootscroll" | // 如果为 rootID 就滚动到指定位置,必有 rootID
|
|
24
29
|
"cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
|
|
25
|
-
"cb-get-history" // 历史渲染
|
|
30
|
+
"cb-get-history" | // 历史渲染
|
|
31
|
+
"cb-get-opennew" // 编辑器只读后新建文件需为临时解锁状态 & https://github.com/siyuan-note/siyuan/issues/12197
|
|
32
|
+
|
|
33
|
+
export type TEditorMode = "preview" | "wysiwyg"
|
|
26
34
|
|
|
27
|
-
interface
|
|
35
|
+
interface ILuteNode {
|
|
36
|
+
TokensStr: () => string;
|
|
37
|
+
__internal_object__: {
|
|
38
|
+
Parent: {
|
|
39
|
+
Type: number,
|
|
40
|
+
},
|
|
41
|
+
HeadingLevel: string,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** @link https://ld246.com/article/1549638745630#options-toolbar */
|
|
46
|
+
interface IMenuItem {
|
|
28
47
|
/** 唯一标示 */
|
|
29
48
|
name: string;
|
|
30
49
|
/** 提示 */
|
|
31
50
|
tip?: string;
|
|
51
|
+
/** 语言 key */
|
|
52
|
+
lang?: string;
|
|
32
53
|
/** svg 图标 */
|
|
33
|
-
icon
|
|
54
|
+
icon?: string;
|
|
34
55
|
/** 快捷键 */
|
|
35
56
|
hotkey?: string;
|
|
36
|
-
/**
|
|
37
|
-
tipPosition
|
|
57
|
+
/** 提示的位置 */
|
|
58
|
+
tipPosition?: string;
|
|
59
|
+
|
|
38
60
|
click?(protyle: Protyle): void;
|
|
39
61
|
}
|
|
40
62
|
|
|
41
|
-
|
|
63
|
+
interface IBreadcrumb {
|
|
64
|
+
id: string,
|
|
65
|
+
name: string,
|
|
66
|
+
type: string,
|
|
67
|
+
subType: string,
|
|
68
|
+
children: []
|
|
69
|
+
}
|
|
42
70
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
interface IOperations {
|
|
72
|
+
doOperations: IOperation[],
|
|
73
|
+
undoOperations: IOperation[]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface IHintData {
|
|
77
|
+
id?: string;
|
|
78
|
+
html: string;
|
|
79
|
+
value: string;
|
|
80
|
+
filter?: string[]
|
|
81
|
+
focus?: boolean
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface IProtyleOptions {
|
|
85
|
+
history?: {
|
|
86
|
+
created?: string
|
|
87
|
+
snapshot?: string
|
|
88
|
+
},
|
|
89
|
+
backlinkData?: {
|
|
90
|
+
blockPaths: IBreadcrumb[],
|
|
91
|
+
dom: string
|
|
92
|
+
expand: boolean
|
|
93
|
+
}[],
|
|
94
|
+
action?: TProtyleAction[],
|
|
95
|
+
mode?: TEditorMode,
|
|
96
|
+
blockId?: string
|
|
97
|
+
rootId?: string
|
|
98
|
+
key?: string
|
|
99
|
+
defId?: string
|
|
60
100
|
render?: {
|
|
61
|
-
background?: boolean
|
|
62
|
-
title?: boolean
|
|
63
|
-
gutter?: boolean
|
|
64
|
-
scroll?: boolean
|
|
65
|
-
breadcrumb?: boolean
|
|
66
|
-
breadcrumbDocName?: boolean
|
|
67
|
-
}
|
|
101
|
+
background?: boolean
|
|
102
|
+
title?: boolean
|
|
103
|
+
gutter?: boolean
|
|
104
|
+
scroll?: boolean
|
|
105
|
+
breadcrumb?: boolean
|
|
106
|
+
breadcrumbDocName?: boolean
|
|
107
|
+
}
|
|
108
|
+
/** 内部调试时使用 */
|
|
109
|
+
_lutePath?: string;
|
|
110
|
+
/** 是否显示日志。默认值: false */
|
|
111
|
+
debugger?: boolean;
|
|
112
|
+
/** 是否启用打字机模式。默认值: false */
|
|
68
113
|
typewriterMode?: boolean;
|
|
114
|
+
/** 多语言。默认值: 'zh_CN' */
|
|
115
|
+
lang?: string;
|
|
116
|
+
/** @link https://ld246.com/article/1549638745630#options-toolbar */
|
|
117
|
+
toolbar?: Array<string | IMenuItem>;
|
|
118
|
+
/** @link https://ld246.com/article/1549638745630#options-classes */
|
|
119
|
+
classes?: {
|
|
120
|
+
preview?: string;
|
|
121
|
+
};
|
|
69
122
|
|
|
123
|
+
/** 编辑器异步渲染完成后的回调方法 */
|
|
70
124
|
after?(protyle: Protyle): void;
|
|
71
125
|
}
|
|
72
126
|
|
|
73
127
|
// REF: https://github.com/siyuan-note/siyuan/blob/dev/app/src/types/protyle.d.ts
|
|
74
128
|
export interface IProtyle {
|
|
75
|
-
getInstance: () => Protyle
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
129
|
+
getInstance: () => Protyle,
|
|
130
|
+
observerLoad?: ResizeObserver,
|
|
131
|
+
observer?: ResizeObserver,
|
|
132
|
+
app: App,
|
|
133
|
+
transactionTime: number,
|
|
134
|
+
id: string,
|
|
135
|
+
query?: {
|
|
136
|
+
key: string,
|
|
137
|
+
method: number
|
|
138
|
+
types: Config.IUILayoutTabSearchConfigTypes
|
|
139
|
+
},
|
|
79
140
|
block: {
|
|
80
|
-
id?: string
|
|
81
|
-
scroll?: boolean
|
|
82
|
-
parentID?: string
|
|
83
|
-
parent2ID?: string
|
|
84
|
-
rootID?: string
|
|
85
|
-
showAll?: boolean
|
|
86
|
-
mode?: number
|
|
87
|
-
blockCount?: number
|
|
88
|
-
action?: string[]
|
|
89
|
-
}
|
|
90
|
-
disabled: boolean
|
|
91
|
-
selectElement?: HTMLElement
|
|
92
|
-
ws?:
|
|
93
|
-
notebookId?: string
|
|
94
|
-
path?: string
|
|
95
|
-
model?:
|
|
141
|
+
id?: string,
|
|
142
|
+
scroll?: boolean
|
|
143
|
+
parentID?: string,
|
|
144
|
+
parent2ID?: string,
|
|
145
|
+
rootID?: string,
|
|
146
|
+
showAll?: boolean
|
|
147
|
+
mode?: number
|
|
148
|
+
blockCount?: number
|
|
149
|
+
action?: string[]
|
|
150
|
+
},
|
|
151
|
+
disabled: boolean,
|
|
152
|
+
selectElement?: HTMLElement,
|
|
153
|
+
ws?: Model,
|
|
154
|
+
notebookId?: string
|
|
155
|
+
path?: string
|
|
156
|
+
model?: Editor,
|
|
96
157
|
updated: boolean;
|
|
97
158
|
element: HTMLElement;
|
|
98
|
-
scroll?:
|
|
99
|
-
gutter?:
|
|
100
|
-
breadcrumb?:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
editElement: HTMLElement;
|
|
106
|
-
element: HTMLElement;
|
|
107
|
-
};
|
|
108
|
-
background?: {
|
|
109
|
-
element: HTMLElement;
|
|
110
|
-
ial: Record<string, string>;
|
|
111
|
-
iconElement: HTMLElement;
|
|
112
|
-
imgElement: HTMLElement;
|
|
113
|
-
tagsElement: HTMLElement;
|
|
114
|
-
transparentData: string;
|
|
115
|
-
};
|
|
116
|
-
contentElement?: HTMLElement;
|
|
117
|
-
options: any;
|
|
159
|
+
scroll?: Scroll,
|
|
160
|
+
gutter?: Gutter,
|
|
161
|
+
breadcrumb?: Breadcrumb,
|
|
162
|
+
title?: Title,
|
|
163
|
+
background?: Background,
|
|
164
|
+
contentElement?: HTMLElement,
|
|
165
|
+
options: IProtyleOptions;
|
|
118
166
|
lute?: Lute;
|
|
119
|
-
toolbar?: Toolbar
|
|
120
|
-
preview?:
|
|
121
|
-
hint?:
|
|
122
|
-
upload?:
|
|
123
|
-
undo?:
|
|
124
|
-
wysiwyg?:
|
|
167
|
+
toolbar?: Toolbar,
|
|
168
|
+
preview?: Preview;
|
|
169
|
+
hint?: Hint;
|
|
170
|
+
upload?: Upload;
|
|
171
|
+
undo?: Undo;
|
|
172
|
+
wysiwyg?: WYSIWYG
|
|
125
173
|
}
|
|
126
174
|
|
|
127
|
-
|
|
175
|
+
declare class Viz {
|
|
176
|
+
constructor(worker: { worker: Worker });
|
|
128
177
|
|
|
129
|
-
|
|
178
|
+
renderSVGElement: (code: string) => Promise<any>;
|
|
179
|
+
}
|
|
130
180
|
|
|
131
|
-
|
|
181
|
+
declare class Viewer {
|
|
182
|
+
public destroyed: boolean;
|
|
183
|
+
|
|
184
|
+
constructor(element: Element, options: {
|
|
185
|
+
title: [number, (image: HTMLImageElement, imageData: IObject) => string],
|
|
186
|
+
button: boolean,
|
|
187
|
+
initialViewIndex?: number,
|
|
188
|
+
transition: boolean,
|
|
189
|
+
hidden: () => void,
|
|
190
|
+
toolbar: {
|
|
191
|
+
zoomIn: boolean,
|
|
192
|
+
zoomOut: boolean,
|
|
193
|
+
oneToOne: boolean,
|
|
194
|
+
reset: boolean,
|
|
195
|
+
prev: boolean,
|
|
196
|
+
play: boolean,
|
|
197
|
+
next: boolean,
|
|
198
|
+
rotateLeft: boolean,
|
|
199
|
+
rotateRight: boolean,
|
|
200
|
+
flipHorizontal: boolean,
|
|
201
|
+
flipVertical: boolean,
|
|
202
|
+
close: () => void
|
|
203
|
+
}
|
|
204
|
+
})
|
|
132
205
|
|
|
133
|
-
|
|
206
|
+
public destroy(): void
|
|
134
207
|
|
|
135
|
-
|
|
208
|
+
public show(): void
|
|
209
|
+
}
|
|
136
210
|
|
|
137
|
-
|
|
211
|
+
declare class Breadcrumb {
|
|
212
|
+
element: HTMLElement;
|
|
138
213
|
|
|
139
|
-
|
|
214
|
+
constructor(protyle: IProtyle);
|
|
140
215
|
|
|
141
|
-
|
|
142
|
-
* @param {boolean} [isBlock=false]
|
|
143
|
-
* @param {boolean} [useProtyleRange=false]
|
|
144
|
-
*/
|
|
145
|
-
insert(html: string, isBlock?: boolean, useProtyleRange?: boolean): void
|
|
216
|
+
toggleExit(hide: boolean): void;
|
|
146
217
|
|
|
147
|
-
|
|
218
|
+
showMenu(protyle: IProtyle, position: IPosition): void;
|
|
148
219
|
|
|
149
|
-
|
|
150
|
-
* 多个块转换为一个块
|
|
151
|
-
* @param {TTurnIntoOneSub} [subType] type 为 "BlocksMergeSuperBlock" 时必传
|
|
152
|
-
*/
|
|
153
|
-
public turnIntoOneTransaction(selectsElement: Element[], type: TTurnIntoOne, subType?: TTurnIntoOneSub): void
|
|
220
|
+
render(protyle: IProtyle, update?: boolean, nodeElement?: Element | false): void;
|
|
154
221
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
* @param {Element} [nodeElement] 优先使用包含 protyle-wysiwyg--select 的块,否则使用 nodeElement 单块
|
|
158
|
-
* @param type
|
|
159
|
-
* @param {number} [subType] type 为 "Blocks2Hs" 时必传
|
|
160
|
-
*/
|
|
161
|
-
public turnIntoTransaction(nodeElement: Element, type: TTurnInto, subType?: number): void
|
|
222
|
+
hide(): void;
|
|
223
|
+
}
|
|
162
224
|
|
|
163
|
-
|
|
225
|
+
declare class Scroll {
|
|
226
|
+
element: HTMLElement;
|
|
227
|
+
private parentElement;
|
|
228
|
+
private inputElement;
|
|
229
|
+
lastScrollTop: number;
|
|
230
|
+
keepLazyLoad: boolean;
|
|
164
231
|
|
|
165
|
-
|
|
232
|
+
constructor(protyle: IProtyle);
|
|
166
233
|
|
|
167
|
-
|
|
234
|
+
private setIndex;
|
|
168
235
|
|
|
169
|
-
|
|
236
|
+
updateIndex(protyle: IProtyle, id: string, cb?: (index: number) => void): void;
|
|
170
237
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
238
|
+
update(protyle: IProtyle): void;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare class WYSIWYG {
|
|
242
|
+
lastHTMLs: {
|
|
243
|
+
[key: string]: string;
|
|
244
|
+
};
|
|
245
|
+
element: HTMLDivElement;
|
|
246
|
+
preventKeyup: boolean;
|
|
247
|
+
private shiftStartElement;
|
|
248
|
+
private preventClick;
|
|
249
|
+
|
|
250
|
+
constructor(protyle: IProtyle);
|
|
251
|
+
|
|
252
|
+
renderCustom(ial: IObject): void;
|
|
253
|
+
|
|
254
|
+
private escapeInline;
|
|
255
|
+
private setEmptyOutline;
|
|
256
|
+
private emojiToMd;
|
|
257
|
+
private bindCommonEvent;
|
|
258
|
+
private bindEvent;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
declare class Gutter {
|
|
262
|
+
element: HTMLElement;
|
|
263
|
+
private gutterTip;
|
|
264
|
+
|
|
265
|
+
constructor(protyle: IProtyle);
|
|
266
|
+
|
|
267
|
+
private isMatchNode;
|
|
268
|
+
private turnsOneInto;
|
|
269
|
+
private turnsIntoOne;
|
|
270
|
+
private turnsInto;
|
|
271
|
+
private showMobileAppearance;
|
|
272
|
+
|
|
273
|
+
renderMultipleMenu(protyle: IProtyle, selectsElement: Element[]): Menu;
|
|
274
|
+
|
|
275
|
+
renderMenu(protyle: IProtyle, buttonElement: Element): Menu;
|
|
276
|
+
|
|
277
|
+
private genHeadingTransform;
|
|
278
|
+
private genClick;
|
|
279
|
+
private genAlign;
|
|
280
|
+
private updateNodeElements;
|
|
281
|
+
private genWidths;
|
|
282
|
+
private genHeights;
|
|
283
|
+
private genCopyTextRef;
|
|
284
|
+
|
|
285
|
+
render(protyle: IProtyle, element: Element, wysiwyg: HTMLElement, target?: Element): void;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare class Title {
|
|
289
|
+
element: HTMLElement;
|
|
290
|
+
editElement: HTMLElement;
|
|
291
|
+
private timeout;
|
|
292
|
+
|
|
293
|
+
constructor(protyle: IProtyle);
|
|
294
|
+
|
|
295
|
+
private rename;
|
|
296
|
+
|
|
297
|
+
setTitle(title: string): void;
|
|
298
|
+
|
|
299
|
+
render(protyle: IProtyle, response: IWebSocketData): boolean;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
declare class Background {
|
|
303
|
+
element: HTMLElement;
|
|
304
|
+
ial: IObject;
|
|
305
|
+
private imgElement;
|
|
306
|
+
private iconElement;
|
|
307
|
+
private actionElements;
|
|
308
|
+
private tagsElement;
|
|
309
|
+
private transparentData;
|
|
310
|
+
|
|
311
|
+
constructor(protyle: IProtyle);
|
|
312
|
+
|
|
313
|
+
private removeTag;
|
|
314
|
+
|
|
315
|
+
render(ial: IObject, rootId: string): void;
|
|
316
|
+
|
|
317
|
+
private openTag;
|
|
318
|
+
private getTags;
|
|
319
|
+
private addTags;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
declare class Preview {
|
|
323
|
+
element: HTMLElement;
|
|
324
|
+
previewElement: HTMLElement;
|
|
325
|
+
private mdTimeoutId;
|
|
326
|
+
|
|
327
|
+
constructor(protyle: IProtyle);
|
|
328
|
+
|
|
329
|
+
render(protyle: IProtyle): void;
|
|
330
|
+
|
|
331
|
+
private link2online;
|
|
332
|
+
private copyToX;
|
|
333
|
+
private processZHBlockquote;
|
|
334
|
+
private processZHTable;
|
|
175
335
|
}
|
|
176
336
|
|
|
177
|
-
|
|
337
|
+
declare class Undo {
|
|
338
|
+
private hasUndo;
|
|
339
|
+
redoStack: IOperations[];
|
|
340
|
+
undoStack: IOperations[];
|
|
341
|
+
|
|
342
|
+
constructor();
|
|
343
|
+
|
|
344
|
+
undo(protyle: IProtyle): void;
|
|
345
|
+
|
|
346
|
+
redo(protyle: IProtyle): void;
|
|
347
|
+
|
|
348
|
+
private render;
|
|
349
|
+
|
|
350
|
+
replace(doOperations: IOperation[], protyle: IProtyle): void;
|
|
351
|
+
|
|
352
|
+
add(doOperations: IOperation[], undoOperations: IOperation[], protyle: IProtyle): void;
|
|
353
|
+
|
|
354
|
+
clear(): void;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
declare class Upload {
|
|
358
|
+
element: HTMLElement;
|
|
359
|
+
isUploading: boolean;
|
|
360
|
+
|
|
361
|
+
constructor();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
declare class Hint {
|
|
365
|
+
timeId: number;
|
|
366
|
+
element: HTMLDivElement;
|
|
367
|
+
enableSlash: boolean;
|
|
368
|
+
private enableEmoji;
|
|
369
|
+
enableExtend: boolean;
|
|
370
|
+
splitChar: string;
|
|
371
|
+
lastIndex: number;
|
|
372
|
+
private source;
|
|
373
|
+
|
|
374
|
+
constructor(protyle: IProtyle);
|
|
375
|
+
|
|
376
|
+
render(protyle: IProtyle): void;
|
|
377
|
+
|
|
378
|
+
genLoading(protyle: IProtyle): void;
|
|
379
|
+
|
|
380
|
+
bindUploadEvent(protyle: IProtyle, element: HTMLElement): void;
|
|
381
|
+
|
|
382
|
+
private getHTMLByData;
|
|
383
|
+
|
|
384
|
+
genHTML(data: IHintData[], protyle: IProtyle, hide: boolean, source: THintSource): void;
|
|
385
|
+
|
|
386
|
+
private genSearchHTML;
|
|
387
|
+
private genEmojiHTML;
|
|
388
|
+
|
|
389
|
+
fill(value: string, protyle: IProtyle, updateRange?: boolean, refIsS?: boolean): void;
|
|
390
|
+
|
|
391
|
+
select(event: KeyboardEvent, protyle: IProtyle): boolean;
|
|
392
|
+
|
|
393
|
+
private fixImageCursor;
|
|
394
|
+
private getKey;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export declare class Toolbar {
|
|
178
398
|
public element: HTMLElement;
|
|
179
399
|
public subElement: HTMLElement;
|
|
180
400
|
public subElementCloseCB: () => void;
|
|
181
401
|
public range: Range;
|
|
402
|
+
public toolbarHeight: number;
|
|
182
403
|
|
|
183
404
|
constructor(protyle: IProtyle)
|
|
184
405
|
|
|
185
|
-
public render(protyle: IProtyle, range: Range, event?: KeyboardEvent)
|
|
186
|
-
|
|
187
|
-
public showContent(protyle: IProtyle, range: Range, nodeElement: Element)
|
|
188
|
-
|
|
189
|
-
public showWidget(protyle: IProtyle, nodeElement: HTMLElement, range: Range)
|
|
190
|
-
|
|
191
|
-
public showTpl(protyle: IProtyle, nodeElement: HTMLElement, range: Range)
|
|
192
|
-
|
|
193
|
-
public showCodeLanguage(protyle: IProtyle, languageElement: HTMLElement)
|
|
406
|
+
public render(protyle: IProtyle, range: Range, event?: KeyboardEvent): void
|
|
194
407
|
|
|
195
|
-
public
|
|
408
|
+
public getCurrentType(range: Range): string[]
|
|
196
409
|
|
|
197
410
|
public setInlineMark(protyle: IProtyle, type: string, action: "range" | "toolbar", textObj?: {
|
|
198
411
|
color?: string,
|
|
199
412
|
type: string
|
|
200
|
-
})
|
|
413
|
+
}): void
|
|
201
414
|
|
|
202
|
-
public
|
|
415
|
+
public showRender(protyle: IProtyle, renderElement: Element, updateElements?: Element[], oldHTML?: string): void
|
|
416
|
+
|
|
417
|
+
public showCodeLanguage(protyle: IProtyle, languageElement: HTMLElement): void
|
|
418
|
+
|
|
419
|
+
public showTpl(protyle: IProtyle, nodeElement: HTMLElement, range: Range): void
|
|
203
420
|
|
|
204
|
-
public
|
|
421
|
+
public showWidget(protyle: IProtyle, nodeElement: HTMLElement, range: Range): void
|
|
422
|
+
|
|
423
|
+
public showContent(protyle: IProtyle, range: Range, nodeElement: Element): void
|
|
205
424
|
}
|
|
206
425
|
|
|
207
426
|
export class Lute {
|
|
@@ -233,8 +452,12 @@ export class Lute {
|
|
|
233
452
|
|
|
234
453
|
public BlockDOM2EscapeMarkerContent(text: string): string;
|
|
235
454
|
|
|
455
|
+
public SetSpin(enable: boolean): void;
|
|
456
|
+
|
|
236
457
|
public SetTextMark(enable: boolean): void;
|
|
237
458
|
|
|
459
|
+
public SetHTMLTag2TextMark(enable: boolean): void;
|
|
460
|
+
|
|
238
461
|
public SetHeadingID(enable: boolean): void;
|
|
239
462
|
|
|
240
463
|
public SetProtyleMarkNetImg(enable: boolean): void;
|
|
@@ -259,18 +482,26 @@ export class Lute {
|
|
|
259
482
|
|
|
260
483
|
public BlockDOM2StdMd(html: string): string;
|
|
261
484
|
|
|
262
|
-
public SetGitConflict(enable: boolean): void;
|
|
263
|
-
|
|
264
485
|
public SetSuperBlock(enable: boolean): void;
|
|
265
486
|
|
|
266
487
|
public SetTag(enable: boolean): void;
|
|
267
488
|
|
|
489
|
+
public SetInlineMath(enable: boolean): void;
|
|
490
|
+
|
|
491
|
+
public SetGFMStrikethrough(enable: boolean): void;
|
|
492
|
+
|
|
493
|
+
public SetGFMStrikethrough1(enable: boolean): void;
|
|
494
|
+
|
|
268
495
|
public SetMark(enable: boolean): void;
|
|
269
496
|
|
|
270
497
|
public SetSub(enable: boolean): void;
|
|
271
498
|
|
|
272
499
|
public SetSup(enable: boolean): void;
|
|
273
500
|
|
|
501
|
+
public SetInlineAsterisk(enable: boolean): void;
|
|
502
|
+
|
|
503
|
+
public SetInlineUnderscore(enable: boolean): void;
|
|
504
|
+
|
|
274
505
|
public SetBlockRef(enable: boolean): void;
|
|
275
506
|
|
|
276
507
|
public SetSanitize(enable: boolean): void;
|
|
@@ -289,7 +520,7 @@ export class Lute {
|
|
|
289
520
|
|
|
290
521
|
public SetFootnotes(enable: boolean): void;
|
|
291
522
|
|
|
292
|
-
public SetLinkRef(
|
|
523
|
+
public SetLinkRef(enable: boolean): void;
|
|
293
524
|
|
|
294
525
|
public SetEmojiSite(emojiSite: string): void;
|
|
295
526
|
|
|
@@ -303,9 +534,72 @@ export class Lute {
|
|
|
303
534
|
|
|
304
535
|
public MarkdownStr(name: string, md: string): string;
|
|
305
536
|
|
|
306
|
-
public
|
|
537
|
+
public GetLinkDest(text: string): string;
|
|
307
538
|
|
|
308
539
|
public BlockDOM2InlineBlockDOM(html: string): string;
|
|
309
540
|
|
|
310
541
|
public BlockDOM2HTML(html: string): string;
|
|
542
|
+
|
|
543
|
+
public HTML2Md(html: string): string;
|
|
544
|
+
|
|
545
|
+
public HTML2BlockDOM(html: string): string;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export class Protyle {
|
|
549
|
+
|
|
550
|
+
public readonly version: string;
|
|
551
|
+
public protyle: IProtyle;
|
|
552
|
+
|
|
553
|
+
constructor(app: App, element: HTMLElement, options?: IProtyleOptions)
|
|
554
|
+
|
|
555
|
+
/** 聚焦到编辑器 */
|
|
556
|
+
public focus(): void
|
|
557
|
+
|
|
558
|
+
/** 上传是否还在进行中 */
|
|
559
|
+
public isUploading(): boolean
|
|
560
|
+
|
|
561
|
+
/** 清空 undo & redo 栈 */
|
|
562
|
+
public clearStack(): void
|
|
563
|
+
|
|
564
|
+
/** 销毁编辑器 */
|
|
565
|
+
public destroy(): void
|
|
566
|
+
|
|
567
|
+
public resize(): void
|
|
568
|
+
|
|
569
|
+
public reload(focus: boolean): void
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* @param {boolean} [isBlock=false]
|
|
573
|
+
* @param {boolean} [useProtyleRange=false]
|
|
574
|
+
*/
|
|
575
|
+
public insert(html: string, isBlock?: boolean, useProtyleRange?: boolean): void
|
|
576
|
+
|
|
577
|
+
public transaction(doOperations: IOperation[], undoOperations?: IOperation[]): void;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* 多个块转换为一个块
|
|
581
|
+
* @param {TTurnIntoOneSub} [subType] type 为 "BlocksMergeSuperBlock" 时必传
|
|
582
|
+
*/
|
|
583
|
+
public turnIntoOneTransaction(selectsElement: Element[], type: TTurnIntoOne, subType?: TTurnIntoOneSub): void
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* 多个块转换
|
|
587
|
+
* @param {Element} [nodeElement] 优先使用包含 protyle-wysiwyg--select 的块,否则使用 nodeElement 单块
|
|
588
|
+
* @param type
|
|
589
|
+
* @param {number} [subType] type 为 "Blocks2Hs" 时必传
|
|
590
|
+
*/
|
|
591
|
+
public turnIntoTransaction(nodeElement: Element, type: TTurnInto, subType?: number): void
|
|
592
|
+
|
|
593
|
+
public updateTransaction(id: string, newHTML: string, html: string): void
|
|
594
|
+
|
|
595
|
+
public updateBatchTransaction(nodeElements: Element[], cb: (e: HTMLElement) => void): void
|
|
596
|
+
|
|
597
|
+
public getRange(element: Element): Range
|
|
598
|
+
|
|
599
|
+
public hasClosestBlock(element: Node): false | HTMLElement
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* @param {boolean} [toStart=true]
|
|
603
|
+
*/
|
|
604
|
+
public focusBlock(element: Element, toStart?: boolean): false | Range
|
|
311
605
|
}
|