@textbus/adapter-react 4.0.0-alpha.36 → 4.0.0-alpha.38
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/index.esm.js +13 -2
- package/bundles/index.js +13 -2
- package/package.json +4 -4
package/bundles/index.esm.js
CHANGED
@@ -42,6 +42,7 @@ class Adapter extends DomAdapter {
|
|
42
42
|
useEffect(() => {
|
43
43
|
this.onViewUpdated.next();
|
44
44
|
}, [updateKey]);
|
45
|
+
component.__slots__.forEach(i => this.renderedSlotCache.delete(i));
|
45
46
|
component.__slots__.length = 0;
|
46
47
|
this.componentRendingStack.push(component);
|
47
48
|
const vNode = components[key]({
|
@@ -56,7 +57,10 @@ class Adapter extends DomAdapter {
|
|
56
57
|
}
|
57
58
|
});
|
58
59
|
useEffect(() => {
|
59
|
-
this.componentRendingStack.
|
60
|
+
const context = this.componentRendingStack[this.componentRendingStack.length - 1];
|
61
|
+
if (context === component) {
|
62
|
+
this.componentRendingStack.pop();
|
63
|
+
}
|
60
64
|
if (!this.componentRootElementCaches.get(component)) {
|
61
65
|
// eslint-disable-next-line max-len
|
62
66
|
throw adapterError(`Component \`${component.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
@@ -78,8 +82,15 @@ class Adapter extends DomAdapter {
|
|
78
82
|
throw adapterError(`cannot found view component \`${component.name}\`!`);
|
79
83
|
}
|
80
84
|
slotRender(slot, slotHostRender, renderEnv) {
|
85
|
+
var _a;
|
81
86
|
const context = this.componentRendingStack[this.componentRendingStack.length - 1];
|
82
|
-
context
|
87
|
+
if (context) {
|
88
|
+
context.__slots__.push(slot);
|
89
|
+
}
|
90
|
+
else if (!this.renderedSlotCache.has(slot)) {
|
91
|
+
throw adapterError(`Unrendered slots must be rendered together with the corresponding "${((_a = slot.parent) === null || _a === void 0 ? void 0 : _a.name) || 'unknown'}" component`);
|
92
|
+
}
|
93
|
+
this.renderedSlotCache.set(slot, true);
|
83
94
|
const vElement = slot.toTree(slotHostRender, renderEnv);
|
84
95
|
this.slotRootVElementCaches.set(slot, vElement);
|
85
96
|
const vNodeToJSX = (vNode) => {
|
package/bundles/index.js
CHANGED
@@ -44,6 +44,7 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
44
44
|
react.useEffect(() => {
|
45
45
|
this.onViewUpdated.next();
|
46
46
|
}, [updateKey]);
|
47
|
+
component.__slots__.forEach(i => this.renderedSlotCache.delete(i));
|
47
48
|
component.__slots__.length = 0;
|
48
49
|
this.componentRendingStack.push(component);
|
49
50
|
const vNode = components[key]({
|
@@ -58,7 +59,10 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
58
59
|
}
|
59
60
|
});
|
60
61
|
react.useEffect(() => {
|
61
|
-
this.componentRendingStack.
|
62
|
+
const context = this.componentRendingStack[this.componentRendingStack.length - 1];
|
63
|
+
if (context === component) {
|
64
|
+
this.componentRendingStack.pop();
|
65
|
+
}
|
62
66
|
if (!this.componentRootElementCaches.get(component)) {
|
63
67
|
// eslint-disable-next-line max-len
|
64
68
|
throw adapterError(`Component \`${component.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
@@ -80,8 +84,15 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
80
84
|
throw adapterError(`cannot found view component \`${component.name}\`!`);
|
81
85
|
}
|
82
86
|
slotRender(slot, slotHostRender, renderEnv) {
|
87
|
+
var _a;
|
83
88
|
const context = this.componentRendingStack[this.componentRendingStack.length - 1];
|
84
|
-
context
|
89
|
+
if (context) {
|
90
|
+
context.__slots__.push(slot);
|
91
|
+
}
|
92
|
+
else if (!this.renderedSlotCache.has(slot)) {
|
93
|
+
throw adapterError(`Unrendered slots must be rendered together with the corresponding "${((_a = slot.parent) === null || _a === void 0 ? void 0 : _a.name) || 'unknown'}" component`);
|
94
|
+
}
|
95
|
+
this.renderedSlotCache.set(slot, true);
|
85
96
|
const vElement = slot.toTree(slotHostRender, renderEnv);
|
86
97
|
this.slotRootVElementCaches.set(slot, vElement);
|
87
98
|
const vNodeToJSX = (vNode) => {
|
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.38",
|
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.3",
|
29
|
-
"@textbus/core": "^4.0.0-alpha.
|
30
|
-
"@textbus/platform-browser": "^4.0.0-alpha.
|
29
|
+
"@textbus/core": "^4.0.0-alpha.38",
|
30
|
+
"@textbus/platform-browser": "^4.0.0-alpha.38",
|
31
31
|
"react": "^17.0.0 || ^18.0.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": "6fd37c779309331bbe5ef1b93b2c3d0d47735636"
|
53
53
|
}
|