bridgerte 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -134
- package/dist/bridge.d.ts +15 -7
- package/dist/core.d.ts +14 -6
- package/dist/dom.cjs +1 -1
- package/dist/dom.d.ts +64 -6
- package/dist/dom.js +4 -3
- package/dist/dom.js.map +1 -1
- package/dist/index-CkgUKPh3.cjs +3 -0
- package/dist/index-CkgUKPh3.cjs.map +1 -0
- package/dist/index-CqOH1_5N.cjs +2 -0
- package/dist/index-CqOH1_5N.cjs.map +1 -0
- package/dist/index-DRWIM218.js +262 -0
- package/dist/index-DRWIM218.js.map +1 -0
- package/dist/{index-C7IVE5Bd.js → index-KRuLtGv9.js} +1696 -1818
- package/dist/index-KRuLtGv9.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +113 -7
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/dist/native-spec.d.ts +32 -6
- package/dist/style.css +1 -1
- package/dist/webview.cjs +1 -1
- package/dist/webview.d.ts +45 -7
- package/dist/webview.js +1 -1
- package/package.json +8 -8
- package/dist/index-BDgKCpty.cjs +0 -3
- package/dist/index-BDgKCpty.cjs.map +0 -1
- package/dist/index-C7IVE5Bd.js.map +0 -1
package/dist/bridge.d.ts
CHANGED
|
@@ -170,8 +170,8 @@ export type PasteHook = (request: PasteRequest) => PasteHookResult | Promise<Pas
|
|
|
170
170
|
/**
|
|
171
171
|
* toolbar JSON 配置里的菜单组。
|
|
172
172
|
*
|
|
173
|
-
* `menuKeys` 使用菜单 schema 的稳定 id,DOM
|
|
174
|
-
*
|
|
173
|
+
* `menuKeys` 使用菜单 schema 的稳定 id,DOM 渲染为一个分组入口,
|
|
174
|
+
* 点击后打开纵向收纳菜单;RN/Flutter/WebView 可按同一结构自绘平台菜单。
|
|
175
175
|
*/
|
|
176
176
|
export type ToolbarGroupConfig = {
|
|
177
177
|
key: string;
|
|
@@ -756,7 +756,6 @@ export type RichTextEditorIcons = Partial<Record<string, string>>;
|
|
|
756
756
|
export type RichTextEditorOptions = {
|
|
757
757
|
value?: Partial<EditorContent>;
|
|
758
758
|
readonly?: boolean;
|
|
759
|
-
platform?: 'pc' | 'h5' | 'webview';
|
|
760
759
|
uploadAdapter?: UploadAdapter;
|
|
761
760
|
/**
|
|
762
761
|
* 媒体节点没有显式 displayWidthPercent 时的默认展示比例。
|
|
@@ -764,14 +763,23 @@ export type RichTextEditorOptions = {
|
|
|
764
763
|
* 默认值是 50;业务可以按产品形态改成 20 或 100,内置 UI 仍只提供固定预设。
|
|
765
764
|
*/
|
|
766
765
|
mediaDefaultWidthPercent?: MediaDisplayWidthPercent;
|
|
766
|
+
/**
|
|
767
|
+
* @deprecated createRichTextEditor 永远只创建编辑器内容实例。
|
|
768
|
+
* toolbar/tabbar 请使用 createRichTextToolbar 或原生侧单独渲染;该字段保留为兼容 no-op。
|
|
769
|
+
*/
|
|
767
770
|
toolbarMode?: 'top' | 'bottom' | 'none' | 'native';
|
|
768
771
|
/**
|
|
769
|
-
* DOM 内置
|
|
772
|
+
* DOM 内置 hoverbar、slash command 等菜单运行时使用的菜单 schema。
|
|
770
773
|
*
|
|
771
|
-
* 自定义菜单必须先进入 schema
|
|
774
|
+
* 自定义菜单必须先进入 schema,再由独立 toolbar 的 `toolbarConfig`、`hoverbarConfig`
|
|
775
|
+
* 或 slash command 配置引用;
|
|
772
776
|
* 这里不接收 SVG,图标展示仍通过 `icons` 按稳定 icon key 覆盖。
|
|
773
777
|
*/
|
|
774
778
|
menuSchema?: MenuItem[];
|
|
779
|
+
/**
|
|
780
|
+
* @deprecated editor 不再自动创建 toolbar/tabbar,该字段在 createRichTextEditor 中是 no-op。
|
|
781
|
+
* 请把 toolbarConfig 传给 createRichTextToolbar(container, { editor, toolbarConfig })。
|
|
782
|
+
*/
|
|
775
783
|
toolbarConfig?: ToolbarConfig;
|
|
776
784
|
/**
|
|
777
785
|
* DOM 内置 hoverbar 的显示结构配置。
|
|
@@ -796,7 +804,7 @@ export type RichTextEditorOptions = {
|
|
|
796
804
|
slashCommandConfig?: ToolbarConfig;
|
|
797
805
|
icons?: RichTextEditorIcons;
|
|
798
806
|
/**
|
|
799
|
-
* DOM 内置 toolbar/tabbar
|
|
807
|
+
* DOM 内置 hoverbar、slash command 以及独立 toolbar/tabbar 的菜单 label 覆盖。
|
|
800
808
|
*
|
|
801
809
|
* key 使用 `MenuItem.id`,只影响按钮文本、tooltip 和 aria-label,不改变命令语义。
|
|
802
810
|
*/
|
|
@@ -912,7 +920,7 @@ export type BridgeEventTiming = {
|
|
|
912
920
|
*
|
|
913
921
|
* 只保留可序列化且跨端稳定的字段,避免把函数或宿主对象塞进 bridge。
|
|
914
922
|
*/
|
|
915
|
-
export type EditorInitOptions = Pick<RichTextEditorOptions, 'readonly' | '
|
|
923
|
+
export type EditorInitOptions = Pick<RichTextEditorOptions, 'readonly' | 'placeholder' | 'maxLength' | 'codeBlockLanguagePanel'> & {
|
|
916
924
|
value?: Partial<EditorContent>;
|
|
917
925
|
};
|
|
918
926
|
/**
|
package/dist/core.d.ts
CHANGED
|
@@ -170,8 +170,8 @@ export type PasteHook = (request: PasteRequest) => PasteHookResult | Promise<Pas
|
|
|
170
170
|
/**
|
|
171
171
|
* toolbar JSON 配置里的菜单组。
|
|
172
172
|
*
|
|
173
|
-
* `menuKeys` 使用菜单 schema 的稳定 id,DOM
|
|
174
|
-
*
|
|
173
|
+
* `menuKeys` 使用菜单 schema 的稳定 id,DOM 渲染为一个分组入口,
|
|
174
|
+
* 点击后打开纵向收纳菜单;RN/Flutter/WebView 可按同一结构自绘平台菜单。
|
|
175
175
|
*/
|
|
176
176
|
export type ToolbarGroupConfig = {
|
|
177
177
|
key: string;
|
|
@@ -756,7 +756,6 @@ export type RichTextEditorIcons = Partial<Record<string, string>>;
|
|
|
756
756
|
export type RichTextEditorOptions = {
|
|
757
757
|
value?: Partial<EditorContent>;
|
|
758
758
|
readonly?: boolean;
|
|
759
|
-
platform?: 'pc' | 'h5' | 'webview';
|
|
760
759
|
uploadAdapter?: UploadAdapter;
|
|
761
760
|
/**
|
|
762
761
|
* 媒体节点没有显式 displayWidthPercent 时的默认展示比例。
|
|
@@ -764,14 +763,23 @@ export type RichTextEditorOptions = {
|
|
|
764
763
|
* 默认值是 50;业务可以按产品形态改成 20 或 100,内置 UI 仍只提供固定预设。
|
|
765
764
|
*/
|
|
766
765
|
mediaDefaultWidthPercent?: MediaDisplayWidthPercent;
|
|
766
|
+
/**
|
|
767
|
+
* @deprecated createRichTextEditor 永远只创建编辑器内容实例。
|
|
768
|
+
* toolbar/tabbar 请使用 createRichTextToolbar 或原生侧单独渲染;该字段保留为兼容 no-op。
|
|
769
|
+
*/
|
|
767
770
|
toolbarMode?: 'top' | 'bottom' | 'none' | 'native';
|
|
768
771
|
/**
|
|
769
|
-
* DOM 内置
|
|
772
|
+
* DOM 内置 hoverbar、slash command 等菜单运行时使用的菜单 schema。
|
|
770
773
|
*
|
|
771
|
-
* 自定义菜单必须先进入 schema
|
|
774
|
+
* 自定义菜单必须先进入 schema,再由独立 toolbar 的 `toolbarConfig`、`hoverbarConfig`
|
|
775
|
+
* 或 slash command 配置引用;
|
|
772
776
|
* 这里不接收 SVG,图标展示仍通过 `icons` 按稳定 icon key 覆盖。
|
|
773
777
|
*/
|
|
774
778
|
menuSchema?: MenuItem[];
|
|
779
|
+
/**
|
|
780
|
+
* @deprecated editor 不再自动创建 toolbar/tabbar,该字段在 createRichTextEditor 中是 no-op。
|
|
781
|
+
* 请把 toolbarConfig 传给 createRichTextToolbar(container, { editor, toolbarConfig })。
|
|
782
|
+
*/
|
|
775
783
|
toolbarConfig?: ToolbarConfig;
|
|
776
784
|
/**
|
|
777
785
|
* DOM 内置 hoverbar 的显示结构配置。
|
|
@@ -796,7 +804,7 @@ export type RichTextEditorOptions = {
|
|
|
796
804
|
slashCommandConfig?: ToolbarConfig;
|
|
797
805
|
icons?: RichTextEditorIcons;
|
|
798
806
|
/**
|
|
799
|
-
* DOM 内置 toolbar/tabbar
|
|
807
|
+
* DOM 内置 hoverbar、slash command 以及独立 toolbar/tabbar 的菜单 label 覆盖。
|
|
800
808
|
*
|
|
801
809
|
* key 使用 `MenuItem.id`,只影响按钮文本、tooltip 和 aria-label,不改变命令语义。
|
|
802
810
|
*/
|
package/dist/dom.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CkgUKPh3.cjs"),t=require("./index-CqOH1_5N.cjs");exports.createFloatingLayer=e.createFloatingLayer;exports.createRichTextEditor=e.createRichTextEditor;exports.createWebViewBridgeRuntime=e.createWebViewBridgeRuntime;exports.createRichTextToolbar=t.createRichTextToolbar;
|
|
2
2
|
//# sourceMappingURL=dom.cjs.map
|
package/dist/dom.d.ts
CHANGED
|
@@ -170,8 +170,8 @@ export type PasteHook = (request: PasteRequest) => PasteHookResult | Promise<Pas
|
|
|
170
170
|
/**
|
|
171
171
|
* toolbar JSON 配置里的菜单组。
|
|
172
172
|
*
|
|
173
|
-
* `menuKeys` 使用菜单 schema 的稳定 id,DOM
|
|
174
|
-
*
|
|
173
|
+
* `menuKeys` 使用菜单 schema 的稳定 id,DOM 渲染为一个分组入口,
|
|
174
|
+
* 点击后打开纵向收纳菜单;RN/Flutter/WebView 可按同一结构自绘平台菜单。
|
|
175
175
|
*/
|
|
176
176
|
export type ToolbarGroupConfig = {
|
|
177
177
|
key: string;
|
|
@@ -756,7 +756,6 @@ export type RichTextEditorIcons = Partial<Record<string, string>>;
|
|
|
756
756
|
export type RichTextEditorOptions = {
|
|
757
757
|
value?: Partial<EditorContent>;
|
|
758
758
|
readonly?: boolean;
|
|
759
|
-
platform?: 'pc' | 'h5' | 'webview';
|
|
760
759
|
uploadAdapter?: UploadAdapter;
|
|
761
760
|
/**
|
|
762
761
|
* 媒体节点没有显式 displayWidthPercent 时的默认展示比例。
|
|
@@ -764,14 +763,23 @@ export type RichTextEditorOptions = {
|
|
|
764
763
|
* 默认值是 50;业务可以按产品形态改成 20 或 100,内置 UI 仍只提供固定预设。
|
|
765
764
|
*/
|
|
766
765
|
mediaDefaultWidthPercent?: MediaDisplayWidthPercent;
|
|
766
|
+
/**
|
|
767
|
+
* @deprecated createRichTextEditor 永远只创建编辑器内容实例。
|
|
768
|
+
* toolbar/tabbar 请使用 createRichTextToolbar 或原生侧单独渲染;该字段保留为兼容 no-op。
|
|
769
|
+
*/
|
|
767
770
|
toolbarMode?: 'top' | 'bottom' | 'none' | 'native';
|
|
768
771
|
/**
|
|
769
|
-
* DOM 内置
|
|
772
|
+
* DOM 内置 hoverbar、slash command 等菜单运行时使用的菜单 schema。
|
|
770
773
|
*
|
|
771
|
-
* 自定义菜单必须先进入 schema
|
|
774
|
+
* 自定义菜单必须先进入 schema,再由独立 toolbar 的 `toolbarConfig`、`hoverbarConfig`
|
|
775
|
+
* 或 slash command 配置引用;
|
|
772
776
|
* 这里不接收 SVG,图标展示仍通过 `icons` 按稳定 icon key 覆盖。
|
|
773
777
|
*/
|
|
774
778
|
menuSchema?: MenuItem[];
|
|
779
|
+
/**
|
|
780
|
+
* @deprecated editor 不再自动创建 toolbar/tabbar,该字段在 createRichTextEditor 中是 no-op。
|
|
781
|
+
* 请把 toolbarConfig 传给 createRichTextToolbar(container, { editor, toolbarConfig })。
|
|
782
|
+
*/
|
|
775
783
|
toolbarConfig?: ToolbarConfig;
|
|
776
784
|
/**
|
|
777
785
|
* DOM 内置 hoverbar 的显示结构配置。
|
|
@@ -796,7 +804,7 @@ export type RichTextEditorOptions = {
|
|
|
796
804
|
slashCommandConfig?: ToolbarConfig;
|
|
797
805
|
icons?: RichTextEditorIcons;
|
|
798
806
|
/**
|
|
799
|
-
* DOM 内置 toolbar/tabbar
|
|
807
|
+
* DOM 内置 hoverbar、slash command 以及独立 toolbar/tabbar 的菜单 label 覆盖。
|
|
800
808
|
*
|
|
801
809
|
* key 使用 `MenuItem.id`,只影响按钮文本、tooltip 和 aria-label,不改变命令语义。
|
|
802
810
|
*/
|
|
@@ -897,7 +905,17 @@ export declare const BRIDGERTE_CONTENT_VERSION = "0.1.0";
|
|
|
897
905
|
export declare const BRIDGERTE_TABLE_INSERT_MAX_ROWS = 20;
|
|
898
906
|
export declare const BRIDGERTE_TABLE_INSERT_MAX_COLS = 20;
|
|
899
907
|
|
|
908
|
+
/**
|
|
909
|
+
* toolbar icon 覆盖表。
|
|
910
|
+
*
|
|
911
|
+
* key 对应 MenuItem.icon 稳定 key,value 是 DOM 侧渲染用 SVG 字符串。
|
|
912
|
+
*/
|
|
900
913
|
export type RichTextToolbarIcons = RichTextEditorIcons;
|
|
914
|
+
/**
|
|
915
|
+
* toolbar 横向拖动状态。
|
|
916
|
+
*
|
|
917
|
+
* PC/H5 都用同一套 pointer 数据,hasDragged 用于区分拖动滚动和真实点击。
|
|
918
|
+
*/
|
|
901
919
|
export type ToolbarDragState = {
|
|
902
920
|
startClientX: number;
|
|
903
921
|
startScrollLeft: number;
|
|
@@ -905,7 +923,27 @@ export type ToolbarDragState = {
|
|
|
905
923
|
hasDragged: boolean;
|
|
906
924
|
startButton?: HTMLButtonElement;
|
|
907
925
|
};
|
|
926
|
+
/**
|
|
927
|
+
* toolbar 分组收纳菜单打开状态。
|
|
928
|
+
*
|
|
929
|
+
* groupKey 对应 ToolbarGroupConfig.key;触发按钮用于定位固定浮层,menu 保存当前组内可执行子项。
|
|
930
|
+
*/
|
|
931
|
+
export type ToolbarGroupMenuState = {
|
|
932
|
+
groupKey: string;
|
|
933
|
+
button: HTMLButtonElement;
|
|
934
|
+
items: MenuItem[];
|
|
935
|
+
};
|
|
936
|
+
/**
|
|
937
|
+
* toolbar 挂载方向。
|
|
938
|
+
*
|
|
939
|
+
* createRichTextToolbar 独立实例只负责自身布局,具体位置由宿主挂载容器决定。
|
|
940
|
+
*/
|
|
908
941
|
export type RichTextToolbarPlacement = 'top' | 'bottom';
|
|
942
|
+
/**
|
|
943
|
+
* 独立 toolbar 创建参数。
|
|
944
|
+
*
|
|
945
|
+
* editor 提供命令和状态,schema/config 决定展示结构,icons/menuLabels 只覆盖显示层。
|
|
946
|
+
*/
|
|
909
947
|
export type RichTextToolbarOptions = {
|
|
910
948
|
editor: EditorAPI;
|
|
911
949
|
menuSchema?: MenuItem[];
|
|
@@ -915,6 +953,11 @@ export type RichTextToolbarOptions = {
|
|
|
915
953
|
menuLabels?: MenuLabelOverrides;
|
|
916
954
|
payloadPanelConfig?: PayloadPanelConfig;
|
|
917
955
|
};
|
|
956
|
+
/**
|
|
957
|
+
* toolbar 实例 API。
|
|
958
|
+
*
|
|
959
|
+
* update 手动刷新命令状态,destroy 释放 DOM listener 和命令状态订阅。
|
|
960
|
+
*/
|
|
918
961
|
export type RichTextToolbarAPI = {
|
|
919
962
|
update(): void;
|
|
920
963
|
destroy(): void;
|
|
@@ -927,13 +970,28 @@ export type RichTextToolbarAPI = {
|
|
|
927
970
|
*/
|
|
928
971
|
export declare function createRichTextToolbar(container: HTMLElement, options: RichTextToolbarOptions): RichTextToolbarAPI;
|
|
929
972
|
|
|
973
|
+
/**
|
|
974
|
+
* 浮层相对锚点的放置方向。
|
|
975
|
+
*
|
|
976
|
+
* 语义对齐 floating-ui placement,方便 DOM 默认层和业务自绘使用同一套位置配置。
|
|
977
|
+
*/
|
|
930
978
|
export type RichTextFloatingPlacement = 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end';
|
|
979
|
+
/**
|
|
980
|
+
* 通用浮层创建选项。
|
|
981
|
+
*
|
|
982
|
+
* root 由实现层持有;这里仅描述定位策略、偏移和边界 padding。
|
|
983
|
+
*/
|
|
931
984
|
export type RichTextFloatingLayerOptions = {
|
|
932
985
|
placement?: RichTextFloatingPlacement;
|
|
933
986
|
offset?: number;
|
|
934
987
|
shiftPadding?: number;
|
|
935
988
|
strategy?: 'absolute' | 'fixed';
|
|
936
989
|
};
|
|
990
|
+
/**
|
|
991
|
+
* 通用浮层实例。
|
|
992
|
+
*
|
|
993
|
+
* update 会重新计算位置,destroy 释放 floating-ui autoUpdate 和 DOM 引用。
|
|
994
|
+
*/
|
|
937
995
|
export type RichTextFloatingLayer = {
|
|
938
996
|
update(): Promise<void>;
|
|
939
997
|
setOpen(open: boolean): void;
|
package/dist/dom.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { c as r, a as t, b as c
|
|
1
|
+
import { c as r, a as t, b as c } from "./index-KRuLtGv9.js";
|
|
2
|
+
import { c as i } from "./index-DRWIM218.js";
|
|
2
3
|
export {
|
|
3
4
|
r as createFloatingLayer,
|
|
4
5
|
t as createRichTextEditor,
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
i as createRichTextToolbar,
|
|
7
|
+
c as createWebViewBridgeRuntime
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=dom.js.map
|
package/dist/dom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dom.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|