@textbus/adapter-viewfly 4.0.0-alpha.32 → 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.
- package/bundles/index.esm.js +25 -1
- package/bundles/index.js +25 -1
- package/package.json +5 -5
package/bundles/index.esm.js
CHANGED
@@ -33,6 +33,10 @@ class Adapter extends DomAdapter {
|
|
33
33
|
onUpdated(() => {
|
34
34
|
this.componentRendingStack.pop();
|
35
35
|
textbusComponent.changeMarker.rendered();
|
36
|
+
if (!this.componentRootElementCaches.get(textbusComponent)) {
|
37
|
+
// eslint-disable-next-line max-len
|
38
|
+
throw adapterError(`Component \`${textbusComponent.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
39
|
+
}
|
36
40
|
});
|
37
41
|
const component = props.component;
|
38
42
|
const instance = components[key](props);
|
@@ -79,6 +83,24 @@ class Adapter extends DomAdapter {
|
|
79
83
|
this.slotRootVElementCaches.set(slot, vElement);
|
80
84
|
const vNodeToJSX = (vNode) => {
|
81
85
|
const children = [];
|
86
|
+
if (this.composition && this.composition.slot === slot) {
|
87
|
+
this.insertCompositionByIndex(slot, vNode, this.composition, () => {
|
88
|
+
const ref = createDynamicRef(node => {
|
89
|
+
this.compositionNode = node;
|
90
|
+
return () => {
|
91
|
+
this.compositionNode = null;
|
92
|
+
};
|
93
|
+
});
|
94
|
+
return new VElement('span', {
|
95
|
+
style: {
|
96
|
+
textDecoration: 'underline'
|
97
|
+
},
|
98
|
+
ref
|
99
|
+
}, [
|
100
|
+
new VTextNode(this.composition.text)
|
101
|
+
]);
|
102
|
+
});
|
103
|
+
}
|
82
104
|
for (let i = 0; i < vNode.children.length; i++) {
|
83
105
|
const child = vNode.children[i];
|
84
106
|
if (child instanceof VElement) {
|
@@ -94,6 +116,8 @@ class Adapter extends DomAdapter {
|
|
94
116
|
}
|
95
117
|
}
|
96
118
|
}
|
119
|
+
const key = vNode.attrs.get('key');
|
120
|
+
vNode.attrs.delete('key');
|
97
121
|
const props = Object.assign({}, (Array.from(vNode.attrs).reduce((a, b) => {
|
98
122
|
a[b[0]] = b[1];
|
99
123
|
return a;
|
@@ -110,7 +134,7 @@ class Adapter extends DomAdapter {
|
|
110
134
|
if (children.length) {
|
111
135
|
props.children = children;
|
112
136
|
}
|
113
|
-
return jsx(vNode.tagName, props);
|
137
|
+
return jsx(vNode.tagName, props, key);
|
114
138
|
};
|
115
139
|
const jsxNode = vNodeToJSX(vElement);
|
116
140
|
const currentRef = jsxNode.props.ref;
|
package/bundles/index.js
CHANGED
@@ -35,6 +35,10 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
35
35
|
core$1.onUpdated(() => {
|
36
36
|
this.componentRendingStack.pop();
|
37
37
|
textbusComponent.changeMarker.rendered();
|
38
|
+
if (!this.componentRootElementCaches.get(textbusComponent)) {
|
39
|
+
// eslint-disable-next-line max-len
|
40
|
+
throw adapterError(`Component \`${textbusComponent.name}\` is not bound to rootRef, you must bind rootRef to the root element node of the component view.`);
|
41
|
+
}
|
38
42
|
});
|
39
43
|
const component = props.component;
|
40
44
|
const instance = components[key](props);
|
@@ -81,6 +85,24 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
81
85
|
this.slotRootVElementCaches.set(slot, vElement);
|
82
86
|
const vNodeToJSX = (vNode) => {
|
83
87
|
const children = [];
|
88
|
+
if (this.composition && this.composition.slot === slot) {
|
89
|
+
this.insertCompositionByIndex(slot, vNode, this.composition, () => {
|
90
|
+
const ref = core$1.createDynamicRef(node => {
|
91
|
+
this.compositionNode = node;
|
92
|
+
return () => {
|
93
|
+
this.compositionNode = null;
|
94
|
+
};
|
95
|
+
});
|
96
|
+
return new core.VElement('span', {
|
97
|
+
style: {
|
98
|
+
textDecoration: 'underline'
|
99
|
+
},
|
100
|
+
ref
|
101
|
+
}, [
|
102
|
+
new core.VTextNode(this.composition.text)
|
103
|
+
]);
|
104
|
+
});
|
105
|
+
}
|
84
106
|
for (let i = 0; i < vNode.children.length; i++) {
|
85
107
|
const child = vNode.children[i];
|
86
108
|
if (child instanceof core.VElement) {
|
@@ -96,6 +118,8 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
96
118
|
}
|
97
119
|
}
|
98
120
|
}
|
121
|
+
const key = vNode.attrs.get('key');
|
122
|
+
vNode.attrs.delete('key');
|
99
123
|
const props = Object.assign({}, (Array.from(vNode.attrs).reduce((a, b) => {
|
100
124
|
a[b[0]] = b[1];
|
101
125
|
return a;
|
@@ -112,7 +136,7 @@ class Adapter extends platformBrowser.DomAdapter {
|
|
112
136
|
if (children.length) {
|
113
137
|
props.children = children;
|
114
138
|
}
|
115
|
-
return core$1.jsx(vNode.tagName, props);
|
139
|
+
return core$1.jsx(vNode.tagName, props, key);
|
116
140
|
};
|
117
141
|
const jsxNode = vNodeToJSX(vElement);
|
118
142
|
const currentRef = jsxNode.props.ref;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/adapter-viewfly",
|
3
|
-
"version": "4.0.0-alpha.
|
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,9 +26,9 @@
|
|
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.
|
31
|
-
"@viewfly/core": "^0.6.
|
29
|
+
"@textbus/core": "^4.0.0-alpha.33",
|
30
|
+
"@textbus/platform-browser": "^4.0.0-alpha.33",
|
31
|
+
"@viewfly/core": "^0.6.3"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
34
|
"@rollup/plugin-commonjs": "^23.0.2",
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"bugs": {
|
49
49
|
"url": "https://github.com/textbus/textbus.git/issues"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "5eb73f9a388d331946a8579aa6eaa23cc44bffe0"
|
52
52
|
}
|