bridgerte 0.9.0
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/README.md +830 -0
- package/dist/bridge.cjs +2 -0
- package/dist/bridge.cjs.map +1 -0
- package/dist/bridge.d.ts +1070 -0
- package/dist/bridge.js +37 -0
- package/dist/bridge.js.map +1 -0
- package/dist/core.cjs +2 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.ts +899 -0
- package/dist/core.js +58 -0
- package/dist/core.js.map +1 -0
- package/dist/dom.cjs +2 -0
- package/dist/dom.cjs.map +1 -0
- package/dist/dom.d.ts +955 -0
- package/dist/dom.js +8 -0
- package/dist/dom.js.map +1 -0
- package/dist/index-BDgKCpty.cjs +3 -0
- package/dist/index-BDgKCpty.cjs.map +1 -0
- package/dist/index-C7IVE5Bd.js +4515 -0
- package/dist/index-C7IVE5Bd.js.map +1 -0
- package/dist/index-CuNKUHed.js +7 -0
- package/dist/index-CuNKUHed.js.map +1 -0
- package/dist/index-GaS65GL0.cjs +2 -0
- package/dist/index-GaS65GL0.cjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1233 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/native-spec.cjs +2 -0
- package/dist/native-spec.cjs.map +1 -0
- package/dist/native-spec.d.ts +953 -0
- package/dist/native-spec.js +594 -0
- package/dist/native-spec.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/webview.cjs +2 -0
- package/dist/webview.cjs.map +1 -0
- package/dist/webview.d.ts +1107 -0
- package/dist/webview.js +5 -0
- package/dist/webview.js.map +1 -0
- package/package.json +76 -0
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,899 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* 此文件由内部包声明生成。
|
|
3
|
+
* 不要手动修改;需要更新时运行 pnpm build 重新生成。
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 编辑器内容中被引用的资源元信息。
|
|
8
|
+
*
|
|
9
|
+
* 这个类型只描述跨端可保存的资源状态,不绑定具体上传实现或 DOM 节点。
|
|
10
|
+
*/
|
|
11
|
+
export type EditorAsset = {
|
|
12
|
+
id: string;
|
|
13
|
+
type: 'image' | 'video';
|
|
14
|
+
url: string;
|
|
15
|
+
status?: 'uploading' | 'success' | 'error';
|
|
16
|
+
progress?: number;
|
|
17
|
+
poster?: string;
|
|
18
|
+
width?: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
duration?: number;
|
|
21
|
+
mimeType?: string;
|
|
22
|
+
size?: number;
|
|
23
|
+
displayWidthPercent?: MediaDisplayWidthPercent;
|
|
24
|
+
align?: MediaAlign;
|
|
25
|
+
errorMessage?: string;
|
|
26
|
+
external?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* DOM 内置媒体控制条第一版只开放固定比例。
|
|
30
|
+
*
|
|
31
|
+
* 这里先收窄为预设值,避免业务端误传任意数字造成 Web/H5/RN/Flutter 展示不一致。
|
|
32
|
+
*/
|
|
33
|
+
export type MediaDisplayWidthPercent = 20 | 50 | 100;
|
|
34
|
+
/**
|
|
35
|
+
* 媒体块在编辑区内容宽度内的水平对齐方式。
|
|
36
|
+
*
|
|
37
|
+
* 对齐只影响展示位置,不改变图片/视频真实尺寸、上传元信息或内容流顺序。
|
|
38
|
+
*/
|
|
39
|
+
export type MediaAlign = 'left' | 'center' | 'right';
|
|
40
|
+
/**
|
|
41
|
+
* BridgeRTE 持久化内容 JSON 的基础节点。
|
|
42
|
+
*
|
|
43
|
+
* v1 可以承载 Lexical editor state 的 JSON 形态,但对外仍归属于 BridgeRTE 内容协议。
|
|
44
|
+
*/
|
|
45
|
+
export type EditorContentNode = {
|
|
46
|
+
type: string;
|
|
47
|
+
version?: number;
|
|
48
|
+
text?: string;
|
|
49
|
+
children?: EditorContentNode[];
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* BridgeRTE 对外保存的结构化内容。
|
|
54
|
+
*
|
|
55
|
+
* 这里保留 root 包裹层,后续即使从 Lexical JSON 迁移也能通过内容协议版本处理。
|
|
56
|
+
*/
|
|
57
|
+
export type EditorContentJson = {
|
|
58
|
+
root: EditorContentNode;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* 编辑器对外读写的稳定内容结构。
|
|
62
|
+
*
|
|
63
|
+
* `html` 是编辑区 HTML 片段,`json` 是 BridgeRTE 内容 JSON,`plainText` 服务搜索摘要。
|
|
64
|
+
*/
|
|
65
|
+
export type EditorContent = {
|
|
66
|
+
html: string;
|
|
67
|
+
json: EditorContentJson;
|
|
68
|
+
plainText: string;
|
|
69
|
+
assets: EditorAsset[];
|
|
70
|
+
version: string;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* 高频内容变更摘要。
|
|
74
|
+
*
|
|
75
|
+
* 输入、selection 和 WebView bridge 这类高频链路只需要知道内容已经变脏、当前文本长度
|
|
76
|
+
* 和协议版本;完整 `EditorContent` 仍由 `getContent()` 或低频保存动作主动读取。
|
|
77
|
+
*/
|
|
78
|
+
export type EditorContentChange = {
|
|
79
|
+
dirty: boolean;
|
|
80
|
+
plainTextLength: number;
|
|
81
|
+
version: string;
|
|
82
|
+
maxLength?: number;
|
|
83
|
+
isOverMaxLength: boolean;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 跨端取消信号的最小契约。
|
|
88
|
+
*
|
|
89
|
+
* 浏览器、RN、Flutter 都可以把各自的取消实现适配成这个结构。
|
|
90
|
+
*/
|
|
91
|
+
export type UploadAbortSignalLike = {
|
|
92
|
+
readonly aborted: boolean;
|
|
93
|
+
addEventListener?: (type: 'abort', listener: () => void, options?: {
|
|
94
|
+
once?: boolean;
|
|
95
|
+
}) => void;
|
|
96
|
+
removeEventListener?: (type: 'abort', listener: () => void) => void;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* 跨端上传文件输入。
|
|
100
|
+
*
|
|
101
|
+
* `data` 保持 unknown,浏览器可放文件对象,RN/Flutter 可放 uri、fileId 或原生文件句柄。
|
|
102
|
+
*/
|
|
103
|
+
export type UploadFileLike = {
|
|
104
|
+
name?: string;
|
|
105
|
+
mimeType?: string;
|
|
106
|
+
size?: number;
|
|
107
|
+
data: unknown;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* 单次上传任务的运行时上下文。
|
|
111
|
+
*
|
|
112
|
+
* `signal` 用于取消上传,`onProgress` 用于把进度回传给编辑器 UI。
|
|
113
|
+
*/
|
|
114
|
+
export type UploadContext = {
|
|
115
|
+
assetId: string;
|
|
116
|
+
onProgress?: (percent: number) => void;
|
|
117
|
+
signal?: UploadAbortSignalLike;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* 上传适配器返回的资源结果。
|
|
121
|
+
*
|
|
122
|
+
* 字段保持后端无关,业务可以按图片、视频能力逐步补齐元信息。
|
|
123
|
+
*/
|
|
124
|
+
export type UploadResult = {
|
|
125
|
+
url: string;
|
|
126
|
+
poster?: string;
|
|
127
|
+
width?: number;
|
|
128
|
+
height?: number;
|
|
129
|
+
duration?: number;
|
|
130
|
+
mimeType?: string;
|
|
131
|
+
size?: number;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* 业务侧注入的上传能力。
|
|
135
|
+
*
|
|
136
|
+
* 编辑器只调用这个契约,不直接绑定 OSS、S3、COS 等具体服务。
|
|
137
|
+
*/
|
|
138
|
+
export type UploadAdapter = {
|
|
139
|
+
uploadImage(file: UploadFileLike, context: UploadContext): Promise<UploadResult>;
|
|
140
|
+
uploadVideo(file: UploadFileLike, context: UploadContext): Promise<UploadResult>;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* 上传失败时对宿主暴露的错误摘要。
|
|
144
|
+
*
|
|
145
|
+
* `cause` 保持 unknown,调用方需要自行收窄具体错误类型。
|
|
146
|
+
*/
|
|
147
|
+
export type UploadError = {
|
|
148
|
+
assetId: string;
|
|
149
|
+
type: 'image' | 'video';
|
|
150
|
+
cause: unknown;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 粘贴事件给业务 hook 的跨端稳定摘要。
|
|
155
|
+
*
|
|
156
|
+
* DOM 端会把 ClipboardEvent 转成这份结构;业务可以阻止默认粘贴,或替换 text/html 后
|
|
157
|
+
* 继续交给 BridgeRTE 的内置 URL 快速路径和 HTML 清洗链路处理。
|
|
158
|
+
*/
|
|
159
|
+
export type PasteRequest = {
|
|
160
|
+
text: string;
|
|
161
|
+
html: string;
|
|
162
|
+
files: UploadFileLike[];
|
|
163
|
+
};
|
|
164
|
+
export type PasteHookResult = boolean | void | {
|
|
165
|
+
text?: string;
|
|
166
|
+
html?: string;
|
|
167
|
+
};
|
|
168
|
+
export type PasteHook = (request: PasteRequest) => PasteHookResult | Promise<PasteHookResult>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* toolbar JSON 配置里的菜单组。
|
|
172
|
+
*
|
|
173
|
+
* `menuKeys` 使用菜单 schema 的稳定 id,DOM 先按简单横向分组渲染;
|
|
174
|
+
* 后续需要下拉菜单时,可以继续复用这份结构。
|
|
175
|
+
*/
|
|
176
|
+
export type ToolbarGroupConfig = {
|
|
177
|
+
key: string;
|
|
178
|
+
title: string;
|
|
179
|
+
icon?: string;
|
|
180
|
+
menuKeys: string[];
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* toolbar JSON 配置项。
|
|
184
|
+
*
|
|
185
|
+
* 字符串使用 `MenuItem.id`;特殊字符串 `|` 表示分割线,视觉保持和默认 group 分隔一致。
|
|
186
|
+
*/
|
|
187
|
+
export type ToolbarKey = string | ToolbarGroupConfig;
|
|
188
|
+
/**
|
|
189
|
+
* 面向业务方的 toolbar JSON 配置。
|
|
190
|
+
*
|
|
191
|
+
* `toolbarKeys` 用于完全决定显示内容和顺序;`insertKeys` 和 `excludeKeys`
|
|
192
|
+
* 用于在默认配置上做增减,心智接近 wangEditor。
|
|
193
|
+
*/
|
|
194
|
+
export type ToolbarConfig = {
|
|
195
|
+
toolbarKeys?: ToolbarKey[];
|
|
196
|
+
insertKeys?: {
|
|
197
|
+
index: number;
|
|
198
|
+
keys: ToolbarKey[];
|
|
199
|
+
};
|
|
200
|
+
excludeKeys?: string[];
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* `@` mention 菜单中的候选项。
|
|
205
|
+
*
|
|
206
|
+
* `data` 用于保留业务扩展字段,但 public API 不规定内部结构。
|
|
207
|
+
*/
|
|
208
|
+
export type MentionItem = {
|
|
209
|
+
id: string;
|
|
210
|
+
label: string;
|
|
211
|
+
value: string;
|
|
212
|
+
avatar?: string;
|
|
213
|
+
description?: string;
|
|
214
|
+
data?: Record<string, unknown>;
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* mention 数据源可以同步返回,也可以异步搜索。
|
|
218
|
+
*/
|
|
219
|
+
export type MentionProvider = (query: string) => Promise<MentionItem[]> | MentionItem[];
|
|
220
|
+
/**
|
|
221
|
+
* mention 候选项展示字段。
|
|
222
|
+
*
|
|
223
|
+
* 顶层字段读取 `MentionItem`;`data.xxx` 读取业务扩展数据,避免 provider 为了 UI 展示
|
|
224
|
+
* 改变稳定的 mention 内容 payload。
|
|
225
|
+
*/
|
|
226
|
+
export type MentionMenuFieldPath = 'id' | 'label' | 'value' | 'avatar' | 'description' | `data.${string}`;
|
|
227
|
+
export type MentionMenuStatus = 'loading' | 'success' | 'empty' | 'error';
|
|
228
|
+
/**
|
|
229
|
+
* mention 菜单展示配置。
|
|
230
|
+
*
|
|
231
|
+
* provider 仍只负责返回候选数据;这里决定默认 DOM UI 和业务自绘 request 如何读取
|
|
232
|
+
* avatar/icon/label/description 字段,以及 loading/empty/error 状态文案。
|
|
233
|
+
*/
|
|
234
|
+
export type MentionMenuConfig = {
|
|
235
|
+
labelField?: MentionMenuFieldPath;
|
|
236
|
+
descriptionField?: MentionMenuFieldPath;
|
|
237
|
+
avatarField?: MentionMenuFieldPath;
|
|
238
|
+
iconField?: MentionMenuFieldPath;
|
|
239
|
+
showAvatar?: boolean;
|
|
240
|
+
showIcon?: boolean;
|
|
241
|
+
showDescription?: boolean;
|
|
242
|
+
loadingText?: string;
|
|
243
|
+
emptyText?: string;
|
|
244
|
+
errorText?: string;
|
|
245
|
+
};
|
|
246
|
+
export type MentionMenuDisplayItem = {
|
|
247
|
+
item: MentionItem;
|
|
248
|
+
label: string;
|
|
249
|
+
description?: string;
|
|
250
|
+
avatar?: string;
|
|
251
|
+
icon?: string;
|
|
252
|
+
};
|
|
253
|
+
export type MentionMenuAnchorRect = {
|
|
254
|
+
x: number;
|
|
255
|
+
y: number;
|
|
256
|
+
width: number;
|
|
257
|
+
height: number;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* 传给业务自绘层的 mention 菜单请求。
|
|
261
|
+
*
|
|
262
|
+
* request 会随着 query 和 provider 状态变化重复发出;业务返回 true 表示接管渲染,
|
|
263
|
+
* 之后通过 submit/cancel 完成选择或取消,DOM 默认菜单不会出现。
|
|
264
|
+
*/
|
|
265
|
+
export type MentionMenuRequest = {
|
|
266
|
+
id: string;
|
|
267
|
+
query: string;
|
|
268
|
+
status: MentionMenuStatus;
|
|
269
|
+
items: MentionMenuDisplayItem[];
|
|
270
|
+
config: MentionMenuConfig;
|
|
271
|
+
readonly: boolean;
|
|
272
|
+
anchorRect?: MentionMenuAnchorRect;
|
|
273
|
+
error?: unknown;
|
|
274
|
+
submit(item: MentionItem): void;
|
|
275
|
+
cancel(): void;
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* 清理格式的范围。
|
|
279
|
+
*
|
|
280
|
+
* `selection` 是默认范围,只清理当前选区内的 inline/block 样式。
|
|
281
|
+
*/
|
|
282
|
+
export type FormatClearScope = 'selection' | 'block';
|
|
283
|
+
/**
|
|
284
|
+
* 代码块语言标识。
|
|
285
|
+
*
|
|
286
|
+
* 保持 string 是为了兼容 highlight.js、Prism 或业务自定义语言表。
|
|
287
|
+
*/
|
|
288
|
+
export type CodeBlockLanguage = string;
|
|
289
|
+
/**
|
|
290
|
+
* 创建代码块时允许携带的参数。
|
|
291
|
+
*/
|
|
292
|
+
export type CodeBlockOptions = {
|
|
293
|
+
language?: CodeBlockLanguage;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* 更新当前代码块语言时允许携带的参数。
|
|
297
|
+
*/
|
|
298
|
+
export type CodeBlockLanguageOptions = {
|
|
299
|
+
language: CodeBlockLanguage;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* 表格行列插入位置,相对当前行列或指定行列计算。
|
|
303
|
+
*/
|
|
304
|
+
export type TableDirection = 'before' | 'after';
|
|
305
|
+
/**
|
|
306
|
+
* 表格命令的目标位置。
|
|
307
|
+
*
|
|
308
|
+
* 不传时由当前选区所在单元格决定。
|
|
309
|
+
*/
|
|
310
|
+
export type TableTarget = {
|
|
311
|
+
rowIndex?: number;
|
|
312
|
+
colIndex?: number;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* 插入表格行的参数。
|
|
316
|
+
*
|
|
317
|
+
* `count` 默认是 1,具体插入位置由 direction 和目标行决定。
|
|
318
|
+
*/
|
|
319
|
+
export type TableInsertRowOptions = TableTarget & {
|
|
320
|
+
direction?: TableDirection;
|
|
321
|
+
count?: number;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* 插入表格列的参数。
|
|
325
|
+
*
|
|
326
|
+
* `count` 默认是 1,具体插入位置由 direction 和目标列决定。
|
|
327
|
+
*/
|
|
328
|
+
export type TableInsertColumnOptions = TableTarget & {
|
|
329
|
+
direction?: TableDirection;
|
|
330
|
+
count?: number;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* 删除表格行的参数。
|
|
334
|
+
*
|
|
335
|
+
* 不传目标时删除当前选区所在行。
|
|
336
|
+
*/
|
|
337
|
+
export type TableDeleteRowOptions = TableTarget & {
|
|
338
|
+
count?: number;
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* 删除表格列的参数。
|
|
342
|
+
*
|
|
343
|
+
* 不传目标时删除当前选区所在列。
|
|
344
|
+
*/
|
|
345
|
+
export type TableDeleteColumnOptions = TableTarget & {
|
|
346
|
+
count?: number;
|
|
347
|
+
};
|
|
348
|
+
/**
|
|
349
|
+
* 插入图片命令的稳定 payload。
|
|
350
|
+
*
|
|
351
|
+
* `assetId` 用于关联 `EditorContent.assets` 中的资源元信息。
|
|
352
|
+
*/
|
|
353
|
+
export type ImageInsertPayload = {
|
|
354
|
+
url: string;
|
|
355
|
+
alt?: string;
|
|
356
|
+
title?: string;
|
|
357
|
+
width?: number;
|
|
358
|
+
height?: number;
|
|
359
|
+
displayWidthPercent?: MediaDisplayWidthPercent;
|
|
360
|
+
align?: MediaAlign;
|
|
361
|
+
assetId?: string;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* 插入视频命令的稳定 payload。
|
|
365
|
+
*
|
|
366
|
+
* `poster` 和尺寸信息用于 DOM 渲染和原生侧预览。
|
|
367
|
+
*/
|
|
368
|
+
export type VideoInsertPayload = {
|
|
369
|
+
url: string;
|
|
370
|
+
poster?: string;
|
|
371
|
+
title?: string;
|
|
372
|
+
width?: number;
|
|
373
|
+
height?: number;
|
|
374
|
+
displayWidthPercent?: MediaDisplayWidthPercent;
|
|
375
|
+
align?: MediaAlign;
|
|
376
|
+
assetId?: string;
|
|
377
|
+
};
|
|
378
|
+
/**
|
|
379
|
+
* 跨端命令协议。
|
|
380
|
+
*
|
|
381
|
+
* 命令只表达编辑语义,不泄漏 Lexical、DOM 或原生平台的实现类型。
|
|
382
|
+
*/
|
|
383
|
+
export type EditorCommand = {
|
|
384
|
+
type: 'format.bold';
|
|
385
|
+
} | {
|
|
386
|
+
type: 'format.italic';
|
|
387
|
+
} | {
|
|
388
|
+
type: 'format.underline';
|
|
389
|
+
} | {
|
|
390
|
+
type: 'format.strike';
|
|
391
|
+
} | {
|
|
392
|
+
type: 'format.inlineCode';
|
|
393
|
+
} | {
|
|
394
|
+
type: 'format.superscript';
|
|
395
|
+
} | {
|
|
396
|
+
type: 'format.subscript';
|
|
397
|
+
} | {
|
|
398
|
+
type: 'format.clear';
|
|
399
|
+
scope?: FormatClearScope;
|
|
400
|
+
} | {
|
|
401
|
+
type: 'format.color';
|
|
402
|
+
value: string;
|
|
403
|
+
} | {
|
|
404
|
+
type: 'format.backgroundColor';
|
|
405
|
+
value: string;
|
|
406
|
+
} | {
|
|
407
|
+
type: 'format.fontSize';
|
|
408
|
+
value: string;
|
|
409
|
+
} | {
|
|
410
|
+
type: 'format.fontFamily';
|
|
411
|
+
value: string;
|
|
412
|
+
} | {
|
|
413
|
+
type: 'format.lineHeight';
|
|
414
|
+
value: string;
|
|
415
|
+
} | {
|
|
416
|
+
type: 'block.heading';
|
|
417
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
418
|
+
} | {
|
|
419
|
+
type: 'block.paragraph';
|
|
420
|
+
} | {
|
|
421
|
+
type: 'block.quote';
|
|
422
|
+
} | {
|
|
423
|
+
type: 'block.divider';
|
|
424
|
+
} | ({
|
|
425
|
+
type: 'block.code';
|
|
426
|
+
} & CodeBlockOptions) | ({
|
|
427
|
+
type: 'block.setCodeLanguage';
|
|
428
|
+
} & CodeBlockLanguageOptions) | {
|
|
429
|
+
type: 'list.ordered';
|
|
430
|
+
} | {
|
|
431
|
+
type: 'list.unordered';
|
|
432
|
+
} | {
|
|
433
|
+
type: 'list.todo';
|
|
434
|
+
} | {
|
|
435
|
+
type: 'align';
|
|
436
|
+
value: 'left' | 'center' | 'right' | 'justify';
|
|
437
|
+
} | {
|
|
438
|
+
type: 'indent.increase';
|
|
439
|
+
} | {
|
|
440
|
+
type: 'indent.decrease';
|
|
441
|
+
} | {
|
|
442
|
+
type: 'link.set';
|
|
443
|
+
href: string;
|
|
444
|
+
text?: string;
|
|
445
|
+
} | {
|
|
446
|
+
type: 'link.unset';
|
|
447
|
+
} | {
|
|
448
|
+
type: 'link.open';
|
|
449
|
+
} | {
|
|
450
|
+
type: 'mention.insert';
|
|
451
|
+
item: MentionItem;
|
|
452
|
+
} | {
|
|
453
|
+
type: 'slash.open';
|
|
454
|
+
} | {
|
|
455
|
+
type: 'media.pickImage';
|
|
456
|
+
} | {
|
|
457
|
+
type: 'media.pickVideo';
|
|
458
|
+
} | {
|
|
459
|
+
type: 'media.retry';
|
|
460
|
+
assetId: string;
|
|
461
|
+
} | {
|
|
462
|
+
type: 'media.remove';
|
|
463
|
+
assetId: string;
|
|
464
|
+
} | {
|
|
465
|
+
type: 'media.resize';
|
|
466
|
+
assetId: string;
|
|
467
|
+
widthPercent: MediaDisplayWidthPercent;
|
|
468
|
+
} | {
|
|
469
|
+
type: 'media.align';
|
|
470
|
+
assetId: string;
|
|
471
|
+
value: MediaAlign;
|
|
472
|
+
} | {
|
|
473
|
+
type: 'media.resetSize';
|
|
474
|
+
assetId: string;
|
|
475
|
+
} | ({
|
|
476
|
+
type: 'media.insertImage';
|
|
477
|
+
} & ImageInsertPayload) | ({
|
|
478
|
+
type: 'media.insertVideo';
|
|
479
|
+
} & VideoInsertPayload) | {
|
|
480
|
+
type: 'table.insert';
|
|
481
|
+
rows: number;
|
|
482
|
+
cols: number;
|
|
483
|
+
} | {
|
|
484
|
+
type: 'table.delete';
|
|
485
|
+
} | ({
|
|
486
|
+
type: 'table.insertRow';
|
|
487
|
+
} & TableInsertRowOptions) | ({
|
|
488
|
+
type: 'table.deleteRow';
|
|
489
|
+
} & TableDeleteRowOptions) | ({
|
|
490
|
+
type: 'table.insertColumn';
|
|
491
|
+
} & TableInsertColumnOptions) | ({
|
|
492
|
+
type: 'table.deleteColumn';
|
|
493
|
+
} & TableDeleteColumnOptions) | {
|
|
494
|
+
type: 'fullscreen.toggle';
|
|
495
|
+
} | {
|
|
496
|
+
type: 'history.undo';
|
|
497
|
+
} | {
|
|
498
|
+
type: 'history.redo';
|
|
499
|
+
} | {
|
|
500
|
+
type: 'content.clear';
|
|
501
|
+
};
|
|
502
|
+
/**
|
|
503
|
+
* 发起参数面板所需的稳定请求体。
|
|
504
|
+
*
|
|
505
|
+
* toolbar、WebView runtime 和业务自绘层都用它描述“哪个菜单需要补哪些参数”。
|
|
506
|
+
|
|
507
|
+
* `command` 直接复用编辑器命令协议,避免 UI 菜单和执行协议分叉。
|
|
508
|
+
*/
|
|
509
|
+
export type SlashCommandItem = {
|
|
510
|
+
id: string;
|
|
511
|
+
label: string;
|
|
512
|
+
command: EditorCommand;
|
|
513
|
+
icon?: string;
|
|
514
|
+
description?: string;
|
|
515
|
+
keywords?: string[];
|
|
516
|
+
group?: string;
|
|
517
|
+
requiresPayload?: boolean;
|
|
518
|
+
payloadPanel?: PayloadPanelSchema;
|
|
519
|
+
};
|
|
520
|
+
export type SlashCommandStatus = 'loading' | 'success' | 'empty' | 'error';
|
|
521
|
+
export type SlashCommandDisplayItem = SlashCommandItem & {
|
|
522
|
+
source: 'schema' | 'provider';
|
|
523
|
+
};
|
|
524
|
+
export type SlashCommandMenuAnchorRect = {
|
|
525
|
+
x: number;
|
|
526
|
+
y: number;
|
|
527
|
+
width: number;
|
|
528
|
+
height: number;
|
|
529
|
+
};
|
|
530
|
+
export type SlashCommandMenuConfig = {
|
|
531
|
+
loadingText?: string;
|
|
532
|
+
emptyText?: string;
|
|
533
|
+
errorText?: string;
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* 传给业务自绘层的 slash command 菜单请求。
|
|
537
|
+
*
|
|
538
|
+
* 默认命令来自 schema/config,provider 只作为动态候选补充;业务返回 true 后通过
|
|
539
|
+
* submit/cancel 接续同一条选择链路,避免 DOM 默认菜单和原生/自绘菜单执行语义分叉。
|
|
540
|
+
*/
|
|
541
|
+
export type SlashCommandMenuRequest = {
|
|
542
|
+
id: string;
|
|
543
|
+
query: string;
|
|
544
|
+
status: SlashCommandStatus;
|
|
545
|
+
items: SlashCommandDisplayItem[];
|
|
546
|
+
config: SlashCommandMenuConfig;
|
|
547
|
+
readonly: boolean;
|
|
548
|
+
anchorRect?: SlashCommandMenuAnchorRect;
|
|
549
|
+
error?: unknown;
|
|
550
|
+
submit(item: SlashCommandDisplayItem | SlashCommandItem): void;
|
|
551
|
+
cancel(): void;
|
|
552
|
+
};
|
|
553
|
+
/**
|
|
554
|
+
* slash command 数据源可以按 query 过滤命令,也可以接入远程数据。
|
|
555
|
+
*/
|
|
556
|
+
export type SlashCommandProvider = (query: string) => Promise<SlashCommandItem[]> | SlashCommandItem[];
|
|
557
|
+
export type CommandState = {
|
|
558
|
+
command: EditorCommand['type'];
|
|
559
|
+
active: boolean;
|
|
560
|
+
disabled: boolean;
|
|
561
|
+
value?: string | number | boolean;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* 跨端菜单项描述。
|
|
566
|
+
*
|
|
567
|
+
* `id` 是 schema/config 引用的稳定 key,`icon` 是跨端稳定图标 key;
|
|
568
|
+
* SVG 或原生图标实例必须由各端 icon map 提供,不能写进 schema。
|
|
569
|
+
*/
|
|
570
|
+
export type MenuItem = {
|
|
571
|
+
id: string;
|
|
572
|
+
command: EditorCommand;
|
|
573
|
+
label: string;
|
|
574
|
+
icon: string;
|
|
575
|
+
group: 'text' | 'style' | 'block' | 'list' | 'align' | 'insert' | 'media' | 'table' | 'history' | 'view';
|
|
576
|
+
requiresPayload?: boolean;
|
|
577
|
+
payloadPanel?: PayloadPanelSchema;
|
|
578
|
+
children?: MenuItem[];
|
|
579
|
+
};
|
|
580
|
+
/**
|
|
581
|
+
* 菜单 label 覆盖表。
|
|
582
|
+
*
|
|
583
|
+
* key 使用 `MenuItem.id`,只影响展示文本、tooltip 和无障碍名称;
|
|
584
|
+
* 不改变 command、payloadPanel 或 schema 稳定 id。
|
|
585
|
+
*/
|
|
586
|
+
export type MenuLabelOverrides = Partial<Record<string, string>>;
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* 参数面板选项。
|
|
590
|
+
*
|
|
591
|
+
* select 字段使用它表达候选项;颜色、字号和业务自绘链接等菜单继续复用同一套面板协议。
|
|
592
|
+
*/
|
|
593
|
+
export type PayloadPanelOption = {
|
|
594
|
+
label: string;
|
|
595
|
+
value: string;
|
|
596
|
+
description?: string;
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* 参数面板字段基础信息。
|
|
600
|
+
*
|
|
601
|
+
* 字段值仍统一以 string 提交,DOM 默认 UI 和 RN/Flutter 自绘层根据 `type` 选择控件。
|
|
602
|
+
*/
|
|
603
|
+
export type PayloadPanelFieldBase = {
|
|
604
|
+
name: string;
|
|
605
|
+
label: string;
|
|
606
|
+
defaultValue?: string;
|
|
607
|
+
placeholder?: string;
|
|
608
|
+
};
|
|
609
|
+
/**
|
|
610
|
+
* 参数面板字段。
|
|
611
|
+
*
|
|
612
|
+
* `select` 服务预设候选;`color` 服务文字颜色和背景色;`text` 服务业务自绘链接等自由输入;
|
|
613
|
+
* `number` 服务表格行列、媒体尺寸等数值参数。
|
|
614
|
+
*/
|
|
615
|
+
export type PayloadPanelField = PayloadPanelFieldBase & ({
|
|
616
|
+
type: 'select';
|
|
617
|
+
options: PayloadPanelOption[];
|
|
618
|
+
} | {
|
|
619
|
+
type: 'color';
|
|
620
|
+
options?: PayloadPanelOption[];
|
|
621
|
+
} | {
|
|
622
|
+
type: 'text';
|
|
623
|
+
} | {
|
|
624
|
+
type: 'number';
|
|
625
|
+
min?: number;
|
|
626
|
+
max?: number;
|
|
627
|
+
step?: number;
|
|
628
|
+
});
|
|
629
|
+
/**
|
|
630
|
+
* 菜单参数面板 schema。
|
|
631
|
+
*
|
|
632
|
+
* `id` 作为跨端稳定标识,`fields` 描述业务需要补齐哪些 command payload 字段。
|
|
633
|
+
*/
|
|
634
|
+
export type PayloadPanelSchema = {
|
|
635
|
+
id: string;
|
|
636
|
+
title: string;
|
|
637
|
+
description?: string;
|
|
638
|
+
fields: PayloadPanelField[];
|
|
639
|
+
};
|
|
640
|
+
/**
|
|
641
|
+
* 参数面板候选项配置。
|
|
642
|
+
*
|
|
643
|
+
* `includeValues` 用于按原始 value 白名单重排;`excludeValues` 用于隐藏候选项;
|
|
644
|
+
* `optionLabels` 和 `optionValues` 以原始 value 为 key,只改展示或最终提交值。
|
|
645
|
+
*/
|
|
646
|
+
export type PayloadPanelFieldOptionConfig = {
|
|
647
|
+
options?: PayloadPanelOption[];
|
|
648
|
+
includeValues?: string[];
|
|
649
|
+
excludeValues?: string[];
|
|
650
|
+
optionLabels?: Partial<Record<string, string>>;
|
|
651
|
+
optionValues?: Partial<Record<string, string>>;
|
|
652
|
+
};
|
|
653
|
+
/**
|
|
654
|
+
* 参数面板字段配置。
|
|
655
|
+
*
|
|
656
|
+
* select/color 字段读取候选项配置;number 字段读取 min/max/step/defaultValue 等数值边界。
|
|
657
|
+
* 未匹配字段会被忽略,避免业务配置误伤不相关 panel。
|
|
658
|
+
*/
|
|
659
|
+
export type PayloadPanelFieldConfig = PayloadPanelFieldOptionConfig & {
|
|
660
|
+
label?: string;
|
|
661
|
+
defaultValue?: string;
|
|
662
|
+
placeholder?: string;
|
|
663
|
+
min?: number;
|
|
664
|
+
max?: number;
|
|
665
|
+
step?: number;
|
|
666
|
+
};
|
|
667
|
+
export type PayloadPanelSchemaConfig = {
|
|
668
|
+
title?: string;
|
|
669
|
+
description?: string;
|
|
670
|
+
fields?: Record<string, PayloadPanelFieldConfig>;
|
|
671
|
+
};
|
|
672
|
+
/**
|
|
673
|
+
* 参数面板配置表。
|
|
674
|
+
*
|
|
675
|
+
* 第一层 key 使用 `PayloadPanelSchema.id`,让 toolbar、hoverbar、code block header、
|
|
676
|
+
* WebView 和业务自绘都能对同一份 panel schema 做一致裁剪。
|
|
677
|
+
*/
|
|
678
|
+
export type PayloadPanelConfig = Record<string, PayloadPanelSchemaConfig>;
|
|
679
|
+
/**
|
|
680
|
+
* 参数面板提交值。
|
|
681
|
+
*
|
|
682
|
+
* 第一版字段值都用 string 表达;具体命令会在 DOM SDK 中按 command type 做最小转换。
|
|
683
|
+
*/
|
|
684
|
+
export type PayloadPanelValues = Record<string, string>;
|
|
685
|
+
/**
|
|
686
|
+
* 参数面板锚点矩形。
|
|
687
|
+
*
|
|
688
|
+
* 这里不用 DOMRect,避免 core 暴露浏览器类型;DOM、RN、Flutter 都能构造这个形状。
|
|
689
|
+
*/
|
|
690
|
+
export type PayloadPanelAnchorRect = {
|
|
691
|
+
x: number;
|
|
692
|
+
y: number;
|
|
693
|
+
width: number;
|
|
694
|
+
height: number;
|
|
695
|
+
};
|
|
696
|
+
export type PayloadPanelOpenRequest = {
|
|
697
|
+
menuId: string;
|
|
698
|
+
command: EditorCommand;
|
|
699
|
+
panel: PayloadPanelSchema;
|
|
700
|
+
anchorRect?: PayloadPanelAnchorRect;
|
|
701
|
+
currentValues?: PayloadPanelValues;
|
|
702
|
+
};
|
|
703
|
+
/**
|
|
704
|
+
* 传给业务自绘层的参数面板请求。
|
|
705
|
+
*
|
|
706
|
+
* `readonly` 表示本次请求只能展示,不能提交修改。
|
|
707
|
+
* `submit` 会把业务收集到的字段值合成为完整命令并执行;readonly 请求下 submit 是 no-op,
|
|
708
|
+
* `cancel` 只关闭本次请求。
|
|
709
|
+
*/
|
|
710
|
+
export type PayloadPanelRequest = PayloadPanelOpenRequest & {
|
|
711
|
+
id: string;
|
|
712
|
+
readonly: boolean;
|
|
713
|
+
submit(values: PayloadPanelValues): void;
|
|
714
|
+
cancel(): void;
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* 解析参数面板 schema。
|
|
719
|
+
*
|
|
720
|
+
* 这个纯函数只处理 schema 数据,不理解 DOM、Lexical 或具体命令;toolbar、hoverbar、
|
|
721
|
+
* code block header 和 WebView host request 都应先走这里,保证默认 UI 和业务自绘同源。
|
|
722
|
+
*/
|
|
723
|
+
export declare const resolvePayloadPanelSchema: (panel: PayloadPanelSchema, config?: PayloadPanelConfig) => PayloadPanelSchema;
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* 编辑器运行时错误摘要。
|
|
727
|
+
*
|
|
728
|
+
* `cause` 保持 unknown,避免把 Lexical、DOM 或宿主环境错误类型泄漏进 public API。
|
|
729
|
+
*/
|
|
730
|
+
export type EditorError = {
|
|
731
|
+
code: string;
|
|
732
|
+
message: string;
|
|
733
|
+
cause?: unknown;
|
|
734
|
+
};
|
|
735
|
+
export type FloatingMenusConfig = {
|
|
736
|
+
/**
|
|
737
|
+
* `@` mention 候选菜单开关。默认开启;关闭后不会监听 `@query` 触发,也不会请求 provider。
|
|
738
|
+
*/
|
|
739
|
+
mention?: boolean;
|
|
740
|
+
/**
|
|
741
|
+
* `/` slash command 候选菜单开关。默认开启;关闭后 `/query` 保持普通文本输入。
|
|
742
|
+
*/
|
|
743
|
+
slash?: boolean;
|
|
744
|
+
/**
|
|
745
|
+
* 选中文本 hoverbar 开关。默认开启;关闭后选区不会出现内置基础格式菜单。
|
|
746
|
+
*/
|
|
747
|
+
hoverbar?: boolean;
|
|
748
|
+
};
|
|
749
|
+
/**
|
|
750
|
+
* DOM 默认菜单 icon 覆盖表。
|
|
751
|
+
*
|
|
752
|
+
* key 使用菜单 schema 的稳定 icon key;DOM 可把 value 当 SVG 字符串渲染,RN/Flutter/WebView
|
|
753
|
+
* 原生菜单可以忽略这个字段并用同一个 key 映射平台 icon。
|
|
754
|
+
*/
|
|
755
|
+
export type RichTextEditorIcons = Partial<Record<string, string>>;
|
|
756
|
+
export type RichTextEditorOptions = {
|
|
757
|
+
value?: Partial<EditorContent>;
|
|
758
|
+
readonly?: boolean;
|
|
759
|
+
platform?: 'pc' | 'h5' | 'webview';
|
|
760
|
+
uploadAdapter?: UploadAdapter;
|
|
761
|
+
/**
|
|
762
|
+
* 媒体节点没有显式 displayWidthPercent 时的默认展示比例。
|
|
763
|
+
*
|
|
764
|
+
* 默认值是 50;业务可以按产品形态改成 20 或 100,内置 UI 仍只提供固定预设。
|
|
765
|
+
*/
|
|
766
|
+
mediaDefaultWidthPercent?: MediaDisplayWidthPercent;
|
|
767
|
+
toolbarMode?: 'top' | 'bottom' | 'none' | 'native';
|
|
768
|
+
/**
|
|
769
|
+
* DOM 内置 toolbar/tabbar/hoverbar 使用的菜单 schema。
|
|
770
|
+
*
|
|
771
|
+
* 自定义菜单必须先进入 schema,再由 `toolbarConfig` 或 `hoverbarConfig` 引用;
|
|
772
|
+
* 这里不接收 SVG,图标展示仍通过 `icons` 按稳定 icon key 覆盖。
|
|
773
|
+
*/
|
|
774
|
+
menuSchema?: MenuItem[];
|
|
775
|
+
toolbarConfig?: ToolbarConfig;
|
|
776
|
+
/**
|
|
777
|
+
* DOM 内置 hoverbar 的显示结构配置。
|
|
778
|
+
*
|
|
779
|
+
* 复用 `ToolbarConfig` 的 key、分割线、insert 和 exclude 语义,避免 hoverbar
|
|
780
|
+
* 形成第二套菜单配置规则。
|
|
781
|
+
*/
|
|
782
|
+
hoverbarConfig?: ToolbarConfig;
|
|
783
|
+
/**
|
|
784
|
+
* DOM 内置图片/视频 overlay controls 的显示结构配置。
|
|
785
|
+
*
|
|
786
|
+
* 复用 `ToolbarConfig` 的 key、分割线、insert 和 exclude 语义;尺寸入口
|
|
787
|
+
* `20%`、`50%`、`100%` 是媒体节点基础可用性,解析时会强制保留。
|
|
788
|
+
*/
|
|
789
|
+
mediaControlsConfig?: ToolbarConfig;
|
|
790
|
+
/**
|
|
791
|
+
* DOM 内置 slash command 的静态命令显示结构配置。
|
|
792
|
+
*
|
|
793
|
+
* 默认命令来自 `menuSchema`;这里复用 `ToolbarConfig` 的 key、分割线、insert 和
|
|
794
|
+
* exclude 语义,避免 slash command 形成第三套排序和隐藏规则。
|
|
795
|
+
*/
|
|
796
|
+
slashCommandConfig?: ToolbarConfig;
|
|
797
|
+
icons?: RichTextEditorIcons;
|
|
798
|
+
/**
|
|
799
|
+
* DOM 内置 toolbar/tabbar/hoverbar 的菜单 label 覆盖。
|
|
800
|
+
*
|
|
801
|
+
* key 使用 `MenuItem.id`,只影响按钮文本、tooltip 和 aria-label,不改变命令语义。
|
|
802
|
+
*/
|
|
803
|
+
menuLabels?: MenuLabelOverrides;
|
|
804
|
+
/**
|
|
805
|
+
* 代码块 header 的语言选择面板。
|
|
806
|
+
*
|
|
807
|
+
* 默认使用内置的 `codeBlockLanguagePanel`;业务可以传入裁剪后的 schema 来控制语言选项
|
|
808
|
+
* 显示哪些、顺序怎么排。
|
|
809
|
+
*/
|
|
810
|
+
codeBlockLanguagePanel?: PayloadPanelSchema;
|
|
811
|
+
/**
|
|
812
|
+
* DOM 内置 payload panel 候选项和字段边界配置。
|
|
813
|
+
*
|
|
814
|
+
* key 使用 panel id;解析后的同一份 schema 会同时进入 DOM 默认 UI 和
|
|
815
|
+
* `onPayloadPanelRequest`,避免默认面板和业务自绘看到两套候选项。
|
|
816
|
+
*/
|
|
817
|
+
payloadPanelConfig?: PayloadPanelConfig;
|
|
818
|
+
/**
|
|
819
|
+
* DOM 内置浮层菜单开关。
|
|
820
|
+
*
|
|
821
|
+
* 默认全部开启;业务在 H5、WebView 或自绘菜单场景下可以按能力关闭,避免默认浮层
|
|
822
|
+
* 影响软键盘、原生菜单或宿主自定义交互。
|
|
823
|
+
*/
|
|
824
|
+
floatingMenus?: FloatingMenusConfig;
|
|
825
|
+
mentionProvider?: MentionProvider;
|
|
826
|
+
/**
|
|
827
|
+
* DOM 默认 mention 候选菜单展示配置。
|
|
828
|
+
*
|
|
829
|
+
* provider 只负责返回候选数据;这里决定默认 UI 和自绘 request 如何读取
|
|
830
|
+
* label、description、avatar 和 icon 字段,以及 loading/empty/error 文案。
|
|
831
|
+
*/
|
|
832
|
+
mentionMenuConfig?: MentionMenuConfig;
|
|
833
|
+
onMentionMenuRequest?: (request: MentionMenuRequest) => boolean | void;
|
|
834
|
+
slashCommandProvider?: SlashCommandProvider;
|
|
835
|
+
slashCommandMenuConfig?: SlashCommandMenuConfig;
|
|
836
|
+
onSlashCommandMenuRequest?: (request: SlashCommandMenuRequest) => boolean | void;
|
|
837
|
+
placeholder?: string;
|
|
838
|
+
maxLength?: number;
|
|
839
|
+
/**
|
|
840
|
+
* DOM 端基础快捷键开关。
|
|
841
|
+
*
|
|
842
|
+
* 默认关闭,避免 H5/WebView 或宿主应用已有快捷键被编辑器默认拦截;需要 PC 快捷键时
|
|
843
|
+
* 由业务显式开启。
|
|
844
|
+
*/
|
|
845
|
+
keyboardShortcuts?: boolean;
|
|
846
|
+
/**
|
|
847
|
+
* 高频内容变更摘要。
|
|
848
|
+
*
|
|
849
|
+
* 默认推荐使用这个回调驱动保存按钮、dirty 状态和字数提示;它不会携带完整
|
|
850
|
+
* html/json/plainText,避免 10w 内容输入时每次变更都触发全量序列化。
|
|
851
|
+
*/
|
|
852
|
+
onContentChange?: (change: EditorContentChange) => void;
|
|
853
|
+
/**
|
|
854
|
+
* 低频完整内容快照。
|
|
855
|
+
*
|
|
856
|
+
* 保留旧 API 兼容已有业务;大文档场景推荐改用 `onContentChange` 监听轻量摘要,
|
|
857
|
+
* 在保存或提交时主动调用 `getContent()`。
|
|
858
|
+
*/
|
|
859
|
+
onChange?: (content: EditorContent) => void;
|
|
860
|
+
onReady?: (api: EditorAPI) => void;
|
|
861
|
+
onCommandStateChange?: (states: CommandState[]) => void;
|
|
862
|
+
onPayloadPanelRequest?: (request: PayloadPanelRequest) => boolean | void;
|
|
863
|
+
onPaste?: PasteHook;
|
|
864
|
+
onFocus?: () => void;
|
|
865
|
+
onBlur?: () => void;
|
|
866
|
+
onError?: (error: EditorError) => void;
|
|
867
|
+
onUploadError?: (error: UploadError) => void;
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* 编辑器实例对宿主暴露的最小能力面。
|
|
871
|
+
*
|
|
872
|
+
* API 只暴露跨端稳定能力,不暴露内部编辑器对象。
|
|
873
|
+
*/
|
|
874
|
+
export type EditorAPI = {
|
|
875
|
+
getContent(): EditorContent;
|
|
876
|
+
setContent(content: Partial<EditorContent>): void;
|
|
877
|
+
executeCommand(command: EditorCommand): void;
|
|
878
|
+
requestPayloadPanel(request: PayloadPanelOpenRequest): void;
|
|
879
|
+
getCommandStates(): CommandState[];
|
|
880
|
+
subscribeCommandStateChange(listener: (states: CommandState[]) => void): () => void;
|
|
881
|
+
setReadonly(readonly: boolean): void;
|
|
882
|
+
focus(): void;
|
|
883
|
+
blur(): void;
|
|
884
|
+
destroy(): void;
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* 内容结构版本号,用于后续内容协议升级时做兼容判断。
|
|
889
|
+
*/
|
|
890
|
+
export declare const BRIDGERTE_CONTENT_VERSION = "0.1.0";
|
|
891
|
+
/**
|
|
892
|
+
* 默认表格插入能力上限。
|
|
893
|
+
*
|
|
894
|
+
* schema、自绘和 DOM 命令执行共用这组边界;DOM 默认面板可以用更小的首屏网格展示,
|
|
895
|
+
* 但最终提交和 API 执行都不应超过这里声明的库内置上限。
|
|
896
|
+
*/
|
|
897
|
+
export declare const BRIDGERTE_TABLE_INSERT_MAX_ROWS = 20;
|
|
898
|
+
export declare const BRIDGERTE_TABLE_INSERT_MAX_COLS = 20;
|
|
899
|
+
|