@textbus/adapter-react 4.0.0-alpha.32 → 4.0.0-alpha.34

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,6 +57,10 @@ class Adapter extends DomAdapter {
57
57
  });
58
58
  useEffect(() => {
59
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
+ }
60
64
  });
61
65
  return vNode;
62
66
  };
@@ -80,6 +84,20 @@ class Adapter extends DomAdapter {
80
84
  this.slotRootVElementCaches.set(slot, vElement);
81
85
  const vNodeToJSX = (vNode) => {
82
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
+ }
83
101
  for (let i = 0; i < vNode.children.length; i++) {
84
102
  const child = vNode.children[i];
85
103
  if (child instanceof VElement) {
package/bundles/index.js CHANGED
@@ -59,6 +59,10 @@ class Adapter extends platformBrowser.DomAdapter {
59
59
  });
60
60
  react.useEffect(() => {
61
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
+ }
62
66
  });
63
67
  return vNode;
64
68
  };
@@ -82,6 +86,20 @@ class Adapter extends platformBrowser.DomAdapter {
82
86
  this.slotRootVElementCaches.set(slot, vElement);
83
87
  const vNodeToJSX = (vNode) => {
84
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
+ }
85
103
  for (let i = 0; i < vNode.children.length; i++) {
86
104
  const child = vNode.children[i];
87
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.32",
3
+ "version": "4.0.0-alpha.34",
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.32",
29
+ "@textbus/core": "^4.0.0-alpha.34",
30
+ "@textbus/platform-browser": "^4.0.0-alpha.34",
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": "00d52c23dde48068e14e46379b85ddac0743c6ff"
52
+ "gitHead": "b6f9bfbce3135865fc0c8a3e6b622a7040019634"
53
53
  }