@textbus/adapter-react 4.0.0-alpha.0 → 4.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/adapter.d.ts +4 -1
- package/bundles/index.esm.js +6 -4
- package/bundles/index.js +6 -4
- package/package.json +4 -4
package/bundles/adapter.d.ts
CHANGED
@@ -9,10 +9,13 @@ export interface ViewComponentProps<T extends Component = Component> {
|
|
9
9
|
export interface ReactAdapterComponents {
|
10
10
|
[key: string]: (props: ViewComponentProps) => JSX.Element;
|
11
11
|
}
|
12
|
+
/**
|
13
|
+
* Textbus 桥接 React 渲染能力适配器,用于在 React 项目中渲染 Textbus 数据
|
14
|
+
*/
|
12
15
|
export declare class Adapter extends DomAdapter<JSX.Element, JSX.Element> {
|
13
16
|
onViewUpdated: Subject<void>;
|
14
17
|
private components;
|
15
18
|
constructor(components: ReactAdapterComponents, mount: (host: HTMLElement, root: JSX.Element) => (void | (() => void)));
|
16
19
|
componentRender(component: ComponentInstance): JSX.Element;
|
17
|
-
slotRender(slot: Slot, slotHostRender: (children: Array<VElement | VTextNode | ComponentInstance>) => VElement): JSX.Element;
|
20
|
+
slotRender(slot: Slot, slotHostRender: (children: Array<VElement | VTextNode | ComponentInstance>) => VElement, renderEnv: any): JSX.Element;
|
18
21
|
}
|
package/bundles/index.esm.js
CHANGED
@@ -16,6 +16,9 @@ Node.prototype.removeChild = function (child) {
|
|
16
16
|
};
|
17
17
|
// hack end
|
18
18
|
const adapterError = makeError('ReactAdapter');
|
19
|
+
/**
|
20
|
+
* Textbus 桥接 React 渲染能力适配器,用于在 React 项目中渲染 Textbus 数据
|
21
|
+
*/
|
19
22
|
class Adapter extends DomAdapter {
|
20
23
|
constructor(components, mount) {
|
21
24
|
super(mount);
|
@@ -45,7 +48,7 @@ class Adapter extends DomAdapter {
|
|
45
48
|
this.componentRootElementCaches.set(component, rootNode);
|
46
49
|
}
|
47
50
|
else {
|
48
|
-
this.componentRootElementCaches.
|
51
|
+
this.componentRootElementCaches.remove(component);
|
49
52
|
}
|
50
53
|
}
|
51
54
|
});
|
@@ -63,8 +66,8 @@ class Adapter extends DomAdapter {
|
|
63
66
|
}
|
64
67
|
throw adapterError(`cannot found view component \`${component.name}\`!`);
|
65
68
|
}
|
66
|
-
slotRender(slot, slotHostRender) {
|
67
|
-
const vElement = slot.toTree(slotHostRender);
|
69
|
+
slotRender(slot, slotHostRender, renderEnv) {
|
70
|
+
const vElement = slot.toTree(slotHostRender, renderEnv);
|
68
71
|
this.slotRootVElementCaches.set(slot, vElement);
|
69
72
|
const vNodeToJSX = (vNode) => {
|
70
73
|
const children = [];
|
@@ -78,7 +81,6 @@ class Adapter extends DomAdapter {
|
|
78
81
|
}
|
79
82
|
else {
|
80
83
|
children.push(this.componentRender(child));
|
81
|
-
child.changeMarker.rendered();
|
82
84
|
}
|
83
85
|
}
|
84
86
|
const props = Object.assign({}, (Array.from(vNode.attrs).reduce((a, b) => {
|
package/bundles/index.js
CHANGED
@@ -18,6 +18,9 @@ Node.prototype.removeChild = function (child) {
|
|
18
18
|
};
|
19
19
|
// hack end
|
20
20
|
const adapterError = core.makeError('ReactAdapter');
|
21
|
+
/**
|
22
|
+
* Textbus 桥接 React 渲染能力适配器,用于在 React 项目中渲染 Textbus 数据
|
23
|
+
*/
|
21
24
|
class Adapter extends platformBrowser.DomAdapter {
|
22
25
|
constructor(components, mount) {
|
23
26
|
super(mount);
|
@@ -47,7 +50,7 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
47
50
|
this.componentRootElementCaches.set(component, rootNode);
|
48
51
|
}
|
49
52
|
else {
|
50
|
-
this.componentRootElementCaches.
|
53
|
+
this.componentRootElementCaches.remove(component);
|
51
54
|
}
|
52
55
|
}
|
53
56
|
});
|
@@ -65,8 +68,8 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
65
68
|
}
|
66
69
|
throw adapterError(`cannot found view component \`${component.name}\`!`);
|
67
70
|
}
|
68
|
-
slotRender(slot, slotHostRender) {
|
69
|
-
const vElement = slot.toTree(slotHostRender);
|
71
|
+
slotRender(slot, slotHostRender, renderEnv) {
|
72
|
+
const vElement = slot.toTree(slotHostRender, renderEnv);
|
70
73
|
this.slotRootVElementCaches.set(slot, vElement);
|
71
74
|
const vNodeToJSX = (vNode) => {
|
72
75
|
const children = [];
|
@@ -80,7 +83,6 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
80
83
|
}
|
81
84
|
else {
|
82
85
|
children.push(this.componentRender(child));
|
83
|
-
child.changeMarker.rendered();
|
84
86
|
}
|
85
87
|
}
|
86
88
|
const props = Object.assign({}, (Array.from(vNode.attrs).reduce((a, b) => {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/adapter-react",
|
3
|
-
"version": "4.0.0-alpha.
|
3
|
+
"version": "4.0.0-alpha.5",
|
4
4
|
"description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
|
5
5
|
"main": "./bundles/index.js",
|
6
6
|
"module": "./bundles/index.esm.js",
|
@@ -26,8 +26,8 @@
|
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
28
|
"@tanbo/stream": "^1.2.0",
|
29
|
-
"@textbus/core": "^4.0.0-alpha.
|
30
|
-
"@textbus/platform-browser": "^4.0.0-alpha.
|
29
|
+
"@textbus/core": "^4.0.0-alpha.5",
|
30
|
+
"@textbus/platform-browser": "^4.0.0-alpha.5",
|
31
31
|
"react": "^18.2.0"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"bugs": {
|
50
50
|
"url": "https://github.com/textbus/textbus.git/issues"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "072831527fe07e7c21a14f3141d55b24d321a690"
|
53
53
|
}
|