@textbus/adapter-vue 4.0.0-alpha.31 → 4.0.0-alpha.32

Sign up to get free protection for your applications and to get access to all the features.
@@ -35,14 +35,31 @@ class Adapter extends DomAdapter {
35
35
  }
36
36
  });
37
37
  onUpdated(() => {
38
+ self.componentRendingStack.pop();
38
39
  component.changeMarker.rendered();
39
40
  self.onViewUpdated.next();
40
41
  });
41
42
  onUnmounted(() => {
42
43
  sub.unsubscribe();
43
44
  });
44
- return setup(props);
45
+ const result = setup(props);
46
+ if (typeof result === 'function') {
47
+ return function () {
48
+ component.__slots__.length = 0;
49
+ self.componentRendingStack.push(component);
50
+ return result();
51
+ };
52
+ }
53
+ return result;
45
54
  };
55
+ if (vueComponent.render) {
56
+ const oldRender = vueComponent.render;
57
+ vueComponent.render = function (context) {
58
+ context.component.__slots__.length = 0;
59
+ self.componentRendingStack.push(context.component);
60
+ oldRender.apply(this, context);
61
+ };
62
+ }
46
63
  this.components[key] = vueComponent;
47
64
  });
48
65
  }
@@ -54,15 +71,11 @@ class Adapter extends DomAdapter {
54
71
  rootRef = ref();
55
72
  this.componentRefs.set(component, rootRef);
56
73
  }
57
- component.__slots__.length = 0;
58
- this.componentRendingStack.push(component);
59
- const vNode = h(comp, {
74
+ return h(comp, {
60
75
  component,
61
76
  rootRef,
62
77
  key: component.id
63
78
  });
64
- this.componentRendingStack.pop();
65
- return vNode;
66
79
  }
67
80
  throw adapterError(`cannot found view component \`${component.name}\`!`);
68
81
  }
package/bundles/index.js CHANGED
@@ -37,14 +37,31 @@ class Adapter extends platformBrowser.DomAdapter {
37
37
  }
38
38
  });
39
39
  vue.onUpdated(() => {
40
+ self.componentRendingStack.pop();
40
41
  component.changeMarker.rendered();
41
42
  self.onViewUpdated.next();
42
43
  });
43
44
  vue.onUnmounted(() => {
44
45
  sub.unsubscribe();
45
46
  });
46
- return setup(props);
47
+ const result = setup(props);
48
+ if (typeof result === 'function') {
49
+ return function () {
50
+ component.__slots__.length = 0;
51
+ self.componentRendingStack.push(component);
52
+ return result();
53
+ };
54
+ }
55
+ return result;
47
56
  };
57
+ if (vueComponent.render) {
58
+ const oldRender = vueComponent.render;
59
+ vueComponent.render = function (context) {
60
+ context.component.__slots__.length = 0;
61
+ self.componentRendingStack.push(context.component);
62
+ oldRender.apply(this, context);
63
+ };
64
+ }
48
65
  this.components[key] = vueComponent;
49
66
  });
50
67
  }
@@ -56,15 +73,11 @@ class Adapter extends platformBrowser.DomAdapter {
56
73
  rootRef = vue.ref();
57
74
  this.componentRefs.set(component, rootRef);
58
75
  }
59
- component.__slots__.length = 0;
60
- this.componentRendingStack.push(component);
61
- const vNode = vue.h(comp, {
76
+ return vue.h(comp, {
62
77
  component,
63
78
  rootRef,
64
79
  key: component.id
65
80
  });
66
- this.componentRendingStack.pop();
67
- return vNode;
68
81
  }
69
82
  throw adapterError(`cannot found view component \`${component.name}\`!`);
70
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/adapter-vue",
3
- "version": "4.0.0-alpha.31",
3
+ "version": "4.0.0-alpha.32",
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",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@tanbo/stream": "^1.2.3",
29
29
  "@textbus/core": "^4.0.0-alpha.31",
30
- "@textbus/platform-browser": "^4.0.0-alpha.31",
30
+ "@textbus/platform-browser": "^4.0.0-alpha.32",
31
31
  "vue": "^3.3.4"
32
32
  },
33
33
  "devDependencies": {
@@ -48,5 +48,5 @@
48
48
  "bugs": {
49
49
  "url": "https://github.com/textbus/textbus.git/issues"
50
50
  },
51
- "gitHead": "54c13967d549e9c3795eb821d84ce3e811139630"
51
+ "gitHead": "00d52c23dde48068e14e46379b85ddac0743c6ff"
52
52
  }