@textbus/adapter-react 4.0.0-alpha.31 → 4.0.0-alpha.33

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.
@@ -55,7 +55,13 @@ class Adapter extends DomAdapter {
55
55
  }
56
56
  }
57
57
  });
58
- this.componentRendingStack.pop();
58
+ useEffect(() => {
59
+ this.componentRendingStack.pop();
60
+ if (!this.componentRootElementCaches.get(component)) {
61
+ // eslint-disable-next-line max-len
62
+ throw adapterError(`Component \`${component.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
63
+ }
64
+ });
59
65
  return vNode;
60
66
  };
61
67
  });
@@ -78,6 +84,20 @@ class Adapter extends DomAdapter {
78
84
  this.slotRootVElementCaches.set(slot, vElement);
79
85
  const vNodeToJSX = (vNode) => {
80
86
  const children = [];
87
+ if (this.composition && this.composition.slot === slot) {
88
+ this.insertCompositionByIndex(slot, vNode, this.composition, () => {
89
+ return new VElement('span', {
90
+ style: {
91
+ textDecoration: 'underline'
92
+ },
93
+ ref: (node) => {
94
+ this.compositionNode = node;
95
+ }
96
+ }, [
97
+ new VTextNode(this.composition.text)
98
+ ]);
99
+ });
100
+ }
81
101
  for (let i = 0; i < vNode.children.length; i++) {
82
102
  const child = vNode.children[i];
83
103
  if (child instanceof VElement) {
package/bundles/index.js CHANGED
@@ -57,7 +57,13 @@ class Adapter extends platformBrowser.DomAdapter {
57
57
  }
58
58
  }
59
59
  });
60
- this.componentRendingStack.pop();
60
+ react.useEffect(() => {
61
+ this.componentRendingStack.pop();
62
+ if (!this.componentRootElementCaches.get(component)) {
63
+ // eslint-disable-next-line max-len
64
+ throw adapterError(`Component \`${component.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
65
+ }
66
+ });
61
67
  return vNode;
62
68
  };
63
69
  });
@@ -80,6 +86,20 @@ class Adapter extends platformBrowser.DomAdapter {
80
86
  this.slotRootVElementCaches.set(slot, vElement);
81
87
  const vNodeToJSX = (vNode) => {
82
88
  const children = [];
89
+ if (this.composition && this.composition.slot === slot) {
90
+ this.insertCompositionByIndex(slot, vNode, this.composition, () => {
91
+ return new core.VElement('span', {
92
+ style: {
93
+ textDecoration: 'underline'
94
+ },
95
+ ref: (node) => {
96
+ this.compositionNode = node;
97
+ }
98
+ }, [
99
+ new core.VTextNode(this.composition.text)
100
+ ]);
101
+ });
102
+ }
83
103
  for (let i = 0; i < vNode.children.length; i++) {
84
104
  const child = vNode.children[i];
85
105
  if (child instanceof core.VElement) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/adapter-react",
3
- "version": "4.0.0-alpha.31",
3
+ "version": "4.0.0-alpha.33",
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.31",
30
- "@textbus/platform-browser": "^4.0.0-alpha.31",
29
+ "@textbus/core": "^4.0.0-alpha.33",
30
+ "@textbus/platform-browser": "^4.0.0-alpha.33",
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": "54c13967d549e9c3795eb821d84ce3e811139630"
52
+ "gitHead": "5eb73f9a388d331946a8579aa6eaa23cc44bffe0"
53
53
  }