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.
@@ -0,0 +1,1233 @@
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
+
900
+ /**
901
+ * 取出菜单命令用于匹配 `CommandState.value` 的稳定值。
902
+ *
903
+ * 同类命令存在多个菜单项时使用这个值区分,比如对齐方式和标题级别。
904
+ */
905
+ export declare const getCommandStateMatchValue: (command: EditorCommand) => CommandState["value"] | undefined;
906
+ /**
907
+ * 判断某条命令状态是否对应一个完整命令 payload。
908
+ */
909
+ export declare const isCommandStateForCommand: (command: EditorCommand, state: CommandState) => boolean;
910
+ /**
911
+ * 判断某条命令状态是否对应一个菜单项。
912
+ *
913
+ * 原生 toolbar 可以用它把 `CommandState[]` 映射回具体按钮 active/disabled 状态。
914
+ */
915
+ export declare const isMenuItemCommandState: (item: MenuItem, state: CommandState) => boolean;
916
+ /**
917
+ * 为给定菜单生成默认禁用状态。
918
+ *
919
+ * 编辑器未 ready 或无选区时,原生 toolbar 可以先使用这组状态兜底。
920
+ */
921
+ export declare function createDisabledCommandStates(menuSchema?: MenuItem[]): CommandState[];
922
+
923
+ export type ResolvedToolbarButtonItem = {
924
+ type: 'button';
925
+ item: MenuItem;
926
+ };
927
+ export type ResolvedToolbarSeparatorItem = {
928
+ type: 'separator';
929
+ key: string;
930
+ };
931
+ export type ResolvedToolbarGroupItem = {
932
+ type: 'group';
933
+ key: string;
934
+ title: string;
935
+ icon?: string;
936
+ items: MenuItem[];
937
+ };
938
+ export type ResolvedToolbarItem = ResolvedToolbarButtonItem | ResolvedToolbarSeparatorItem | ResolvedToolbarGroupItem;
939
+
940
+ /**
941
+ * 默认 DOM toolbar 配置。
942
+ *
943
+ * 这里只选择已实现或带参数面板的基础按钮;完整菜单全集仍由 `defaultMenuSchema` 维护。
944
+ */
945
+ export declare const defaultToolbarConfig: ToolbarConfig;
946
+ /**
947
+ * 把 wangEditor 风格的 JSON 配置解析成 DOM/RN/Flutter 都能消费的菜单结构。
948
+ *
949
+ * 未知 key 和缺少 payloadPanel 的 requiresPayload 菜单会被忽略,避免默认 toolbar 渲染无法处理的按钮。
950
+ * 分割线会自动去掉开头、结尾和连续项,避免被跳过的菜单留下空分隔。
951
+ */
952
+ export declare const resolveToolbarMenu: (toolbarConfig?: ToolbarConfig, menuSchema?: MenuItem[]) => ResolvedToolbarItem[];
953
+
954
+ /**
955
+ * bridge 高频事件策略摘要。
956
+ *
957
+ * 原生侧可以根据 ready payload 或文档预期理解编辑器事件频率。
958
+ */
959
+ export type BridgeEventTiming = {
960
+ contentChangeDebounceMs: number;
961
+ heightChangeThrottleMs: number;
962
+ commandStateChangeDedupe: boolean;
963
+ };
964
+ /**
965
+ * 原生侧初始化 WebView 编辑器时允许传入的配置子集。
966
+ *
967
+ * 只保留可序列化且跨端稳定的字段,避免把函数或宿主对象塞进 bridge。
968
+ */
969
+ export type EditorInitOptions = Pick<RichTextEditorOptions, 'readonly' | 'platform' | 'toolbarMode' | 'placeholder' | 'maxLength' | 'codeBlockLanguagePanel'> & {
970
+ value?: Partial<EditorContent>;
971
+ };
972
+ /**
973
+ * 原生上传完成后回写给编辑器的成功结果。
974
+ */
975
+ export type UploadResolvedPayload = {
976
+ assetId: string;
977
+ result: UploadResult;
978
+ };
979
+ /**
980
+ * 原生上传失败后回写给编辑器的错误摘要。
981
+ */
982
+ export type UploadRejectedPayload = {
983
+ assetId: string;
984
+ message: string;
985
+ };
986
+ /**
987
+ * 编辑器请求原生侧选择或上传媒体文件时发送的 payload。
988
+ */
989
+ export type UploadRequest = {
990
+ assetId: string;
991
+ type: 'image' | 'video';
992
+ accept: string;
993
+ };
994
+ /**
995
+ * 选区摘要只表达原生 toolbar 需要知道的最小状态。
996
+ */
997
+ export type SelectionState = {
998
+ collapsed: boolean;
999
+ };
1000
+ /**
1001
+ * 原生侧完成参数面板后回传的结果。
1002
+ *
1003
+ * `requestId` 对应编辑器发出的 `editor.payloadPanelRequest.id`。
1004
+ */
1005
+ export type PayloadPanelResolvedPayload = {
1006
+ requestId: string;
1007
+ values: PayloadPanelValues;
1008
+ };
1009
+ export type PayloadPanelCanceledPayload = {
1010
+ requestId: string;
1011
+ };
1012
+ export type PayloadPanelRequestPayload = PayloadPanelOpenRequest & {
1013
+ id: string;
1014
+ readonly: boolean;
1015
+ };
1016
+ /**
1017
+ * 编辑器 ready 后回传给原生侧的初始化结果。
1018
+ */
1019
+ export type EditorReadyPayload = {
1020
+ menuSchema: MenuItem[];
1021
+ eventTiming: BridgeEventTiming;
1022
+ version: string;
1023
+ };
1024
+ /**
1025
+ * 原生侧发给编辑器的消息集合。
1026
+ */
1027
+ export type NativeToEditorMessage = {
1028
+ id: string;
1029
+ type: 'editor.init';
1030
+ payload: EditorInitOptions;
1031
+ } | {
1032
+ id: string;
1033
+ type: 'editor.executeCommand';
1034
+ payload: EditorCommand;
1035
+ } | {
1036
+ id: string;
1037
+ type: 'editor.setContent';
1038
+ payload: Partial<EditorContent>;
1039
+ } | {
1040
+ id: string;
1041
+ type: 'editor.setReadonly';
1042
+ payload: {
1043
+ readonly: boolean;
1044
+ };
1045
+ } | {
1046
+ id: string;
1047
+ type: 'editor.requestContent';
1048
+ } | {
1049
+ id: string;
1050
+ type: 'editor.payloadPanelResolved';
1051
+ payload: PayloadPanelResolvedPayload;
1052
+ } | {
1053
+ id: string;
1054
+ type: 'editor.payloadPanelCanceled';
1055
+ payload: PayloadPanelCanceledPayload;
1056
+ } | {
1057
+ id: string;
1058
+ type: 'editor.uploadResolved';
1059
+ payload: UploadResolvedPayload;
1060
+ } | {
1061
+ id: string;
1062
+ type: 'editor.uploadRejected';
1063
+ payload: UploadRejectedPayload;
1064
+ };
1065
+ /**
1066
+ * 编辑器发给原生侧的消息集合。
1067
+ */
1068
+ export type EditorToNativeMessage = {
1069
+ id?: string;
1070
+ type: 'editor.ready';
1071
+ payload: EditorReadyPayload;
1072
+ } | {
1073
+ id?: string;
1074
+ type: 'editor.content';
1075
+ payload: EditorContent;
1076
+ } | {
1077
+ id?: string;
1078
+ type: 'editor.contentChange';
1079
+ payload: EditorContentChange | EditorContent;
1080
+ } | {
1081
+ id?: string;
1082
+ type: 'editor.selectionChange';
1083
+ payload: SelectionState;
1084
+ } | {
1085
+ id?: string;
1086
+ type: 'editor.commandStateChange';
1087
+ payload: CommandState[];
1088
+ } | {
1089
+ id?: string;
1090
+ type: 'editor.payloadPanelRequest';
1091
+ payload: PayloadPanelRequestPayload;
1092
+ } | {
1093
+ id?: string;
1094
+ type: 'editor.uploadRequest';
1095
+ payload: UploadRequest;
1096
+ } | {
1097
+ id?: string;
1098
+ type: 'editor.heightChange';
1099
+ payload: {
1100
+ height: number;
1101
+ };
1102
+ } | {
1103
+ id?: string;
1104
+ type: 'editor.error';
1105
+ payload: EditorError;
1106
+ };
1107
+ export type BridgeMessage = NativeToEditorMessage | EditorToNativeMessage;
1108
+
1109
+ /**
1110
+ * bridge 高频事件的默认节流策略。
1111
+ *
1112
+ * 这里先固定协议默认值,真正的 WebView runtime 会在发送消息时使用这些数值。
1113
+ */
1114
+ export declare const BRIDGE_CONTENT_CHANGE_DEBOUNCE_MS = 120;
1115
+ export declare const BRIDGE_HEIGHT_CHANGE_THROTTLE_MS = 100;
1116
+ export declare const defaultBridgeEventTiming: BridgeEventTiming;
1117
+ /**
1118
+ * bridge 消息的已知类型守卫。
1119
+ *
1120
+ * 这里只校验消息外层类型,深层 payload 校验留给具体消息处理器。
1121
+ * 这样能在轻量运行时判断和完整业务校验之间保持边界清楚。
1122
+ */
1123
+ export declare function isBridgeMessage(value: unknown): value is BridgeMessage;
1124
+
1125
+ export type RichTextToolbarIcons = RichTextEditorIcons;
1126
+ export type ToolbarDragState = {
1127
+ startClientX: number;
1128
+ startScrollLeft: number;
1129
+ pointerType: string;
1130
+ hasDragged: boolean;
1131
+ startButton?: HTMLButtonElement;
1132
+ };
1133
+ export type RichTextToolbarPlacement = 'top' | 'bottom';
1134
+ export type RichTextToolbarOptions = {
1135
+ editor: EditorAPI;
1136
+ menuSchema?: MenuItem[];
1137
+ toolbarConfig?: ToolbarConfig;
1138
+ placement?: RichTextToolbarPlacement;
1139
+ icons?: RichTextToolbarIcons;
1140
+ menuLabels?: MenuLabelOverrides;
1141
+ payloadPanelConfig?: PayloadPanelConfig;
1142
+ };
1143
+ export type RichTextToolbarAPI = {
1144
+ update(): void;
1145
+ destroy(): void;
1146
+ };
1147
+
1148
+ /**
1149
+ * 创建独立菜单实例。
1150
+ *
1151
+ * toolbar/tabbar 只订阅 EditorAPI 状态并派发命令,不接触编辑器内部 DOM 或 Lexical 实例。
1152
+ */
1153
+ export declare function createRichTextToolbar(container: HTMLElement, options: RichTextToolbarOptions): RichTextToolbarAPI;
1154
+
1155
+ export type RichTextFloatingPlacement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
1156
+ export type RichTextFloatingLayerOptions = {
1157
+ placement?: RichTextFloatingPlacement;
1158
+ offset?: number;
1159
+ shiftPadding?: number;
1160
+ strategy?: 'absolute' | 'fixed';
1161
+ };
1162
+ export type RichTextFloatingLayer = {
1163
+ update(): Promise<void>;
1164
+ setOpen(open: boolean): void;
1165
+ destroy(): void;
1166
+ };
1167
+
1168
+ /**
1169
+ * 统一浮层定位能力。
1170
+ *
1171
+ * hoverbar、mention 和 slash menu 都从这里复用定位、翻转、键盘可视区和边界避让逻辑。
1172
+ */
1173
+ export declare function createFloatingLayer(reference: HTMLElement, floating: HTMLElement, options?: RichTextFloatingLayerOptions): RichTextFloatingLayer;
1174
+
1175
+ /**
1176
+ * 创建浏览器 DOM 编辑器实例。
1177
+ * Lexical 只作为内部编辑器内核,public API 继续保持 BridgeRTE 的跨端契约。
1178
+ */
1179
+ export declare function createRichTextEditor(container: HTMLElement, options?: RichTextEditorOptions): EditorAPI;
1180
+
1181
+ export type WebViewBridgeMessageListener = (message: BridgeMessage) => void;
1182
+ export type WebViewBridgeRuntimeTransport = {
1183
+ /**
1184
+ * Runtime 通过这个函数把 EditorToNativeMessage 发给 RN/Flutter 外壳。
1185
+ *
1186
+ * DOM SDK 不直接依赖 ReactNativeWebView 或 Flutter channel,避免把具体宿主全局对象写进库。
1187
+ */
1188
+ postMessage(message: EditorToNativeMessage): void;
1189
+ /**
1190
+ * 宿主把 NativeToEditorMessage 转交给 runtime。
1191
+ *
1192
+ * 返回值负责解绑监听;如果宿主只想手动调用 `runtime.receive()`,可以不传这个函数。
1193
+ */
1194
+ addMessageListener?: (listener: WebViewBridgeMessageListener) => () => void;
1195
+ };
1196
+ export type WebViewBridgeRuntimeOptions = {
1197
+ container: HTMLElement;
1198
+ transport: WebViewBridgeRuntimeTransport;
1199
+ };
1200
+ export type WebViewBridgeRuntime = {
1201
+ receive(message: NativeToEditorMessage | unknown): void;
1202
+ destroy(): void;
1203
+ };
1204
+ export type PendingNativeUpload = {
1205
+ type: 'image' | 'video';
1206
+ assetId: string;
1207
+ } & ({
1208
+ source: 'uploadAdapter';
1209
+ resolve(result: UploadResult): void;
1210
+ reject(error: Error): void;
1211
+ } | {
1212
+ source: 'nativePicker';
1213
+ });
1214
+ export type PendingNativePayloadPanelRequest = {
1215
+ request: PayloadPanelRequest;
1216
+ };
1217
+ export type NativeUploadResultMessage = {
1218
+ type: 'editor.uploadResolved';
1219
+ payload: UploadResolvedPayload;
1220
+ } | {
1221
+ type: 'editor.uploadRejected';
1222
+ payload: UploadRejectedPayload;
1223
+ };
1224
+
1225
+ /**
1226
+ * 创建 WebView bridge runtime。
1227
+ *
1228
+ * Runtime 只做协议适配:native 消息进来后调用 EditorAPI,编辑器事件再转成
1229
+ * EditorToNativeMessage。它不暴露 Lexical、DOM 节点或上传文件对象,确保 RN/Flutter
1230
+ * 只依赖稳定 bridge 协议。
1231
+ */
1232
+ export declare const createWebViewBridgeRuntime: ({ container, transport }: WebViewBridgeRuntimeOptions) => WebViewBridgeRuntime;
1233
+