@textbus/adapter-viewfly 4.3.3 → 4.3.5

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.
@@ -1,5 +1,5 @@
1
1
  import { makeError, VElement, VTextNode, merge, Adapter } from '@textbus/core';
2
- import { createDynamicRef, DynamicRef, jsx, withAnnotation, getCurrentInstance, onUpdated, ReflectiveInjector } from '@viewfly/core';
2
+ import { createDynamicRef, DynamicRef, jsx, withAnnotation, getCurrentInstance, onUnmounted, onUpdated, ReflectiveInjector } from '@viewfly/core';
3
3
  import { DomAdapter } from '@textbus/platform-browser';
4
4
  import { NodeViewAdapter } from '@textbus/platform-node';
5
5
 
@@ -95,18 +95,31 @@ class ViewflyAdapter extends DomAdapter {
95
95
  return jsx(vNode.tagName, props, key);
96
96
  }
97
97
  }, mount);
98
- this.components = {};
99
- this.componentRefs = new WeakMap();
98
+ Object.defineProperty(this, "components", {
99
+ enumerable: true,
100
+ configurable: true,
101
+ writable: true,
102
+ value: {}
103
+ });
104
+ Object.defineProperty(this, "componentRefs", {
105
+ enumerable: true,
106
+ configurable: true,
107
+ writable: true,
108
+ value: new WeakMap()
109
+ });
100
110
  let isRoot = true;
101
111
  Object.entries(components).forEach(([key, viewFlyComponent]) => {
102
112
  this.components[key] = withAnnotation(Object.assign({}, viewFlyComponent.annotation), (props) => {
103
113
  const comp = getCurrentInstance();
104
114
  const textbusComponent = props.component;
105
- merge(textbusComponent.changeMarker.onChange, textbusComponent.changeMarker.onForceChange).subscribe(() => {
115
+ const subscription = merge(textbusComponent.changeMarker.onChange, textbusComponent.changeMarker.onForceChange).subscribe(() => {
106
116
  if (textbusComponent.changeMarker.dirty) {
107
117
  comp.markAsDirtied();
108
118
  }
109
119
  });
120
+ onUnmounted(() => {
121
+ subscription.unsubscribe();
122
+ });
110
123
  if (isRoot) {
111
124
  onUpdated(() => {
112
125
  this.onViewUpdated.next();
package/bundles/index.js CHANGED
@@ -97,18 +97,31 @@ class ViewflyAdapter extends platformBrowser.DomAdapter {
97
97
  return core$1.jsx(vNode.tagName, props, key);
98
98
  }
99
99
  }, mount);
100
- this.components = {};
101
- this.componentRefs = new WeakMap();
100
+ Object.defineProperty(this, "components", {
101
+ enumerable: true,
102
+ configurable: true,
103
+ writable: true,
104
+ value: {}
105
+ });
106
+ Object.defineProperty(this, "componentRefs", {
107
+ enumerable: true,
108
+ configurable: true,
109
+ writable: true,
110
+ value: new WeakMap()
111
+ });
102
112
  let isRoot = true;
103
113
  Object.entries(components).forEach(([key, viewFlyComponent]) => {
104
114
  this.components[key] = core$1.withAnnotation(Object.assign({}, viewFlyComponent.annotation), (props) => {
105
115
  const comp = core$1.getCurrentInstance();
106
116
  const textbusComponent = props.component;
107
- core.merge(textbusComponent.changeMarker.onChange, textbusComponent.changeMarker.onForceChange).subscribe(() => {
117
+ const subscription = core.merge(textbusComponent.changeMarker.onChange, textbusComponent.changeMarker.onForceChange).subscribe(() => {
108
118
  if (textbusComponent.changeMarker.dirty) {
109
119
  comp.markAsDirtied();
110
120
  }
111
121
  });
122
+ core$1.onUnmounted(() => {
123
+ subscription.unsubscribe();
124
+ });
112
125
  if (isRoot) {
113
126
  core$1.onUpdated(() => {
114
127
  this.onViewUpdated.next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/adapter-viewfly",
3
- "version": "4.3.3",
3
+ "version": "4.3.5",
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,11 +26,11 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "@tanbo/stream": "^1.2.6",
29
- "@textbus/core": "^4.3.3",
30
- "@textbus/platform-browser": "^4.3.3",
31
- "@textbus/platform-node": "^4.3.3",
32
- "@viewfly/core": "^1.1.2",
33
- "@viewfly/platform-browser": "^1.1.5"
29
+ "@textbus/core": "^4.3.5",
30
+ "@textbus/platform-browser": "^4.3.5",
31
+ "@textbus/platform-node": "^4.3.5",
32
+ "@viewfly/core": "^1.1.10",
33
+ "@viewfly/platform-browser": "^1.1.10"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@rollup/plugin-commonjs": "^23.0.2",
@@ -50,5 +50,5 @@
50
50
  "bugs": {
51
51
  "url": "https://github.com/textbus/textbus.git/issues"
52
52
  },
53
- "gitHead": "d07e5acf88c96bb8eb37760fd71ccc00ae5d3f5b"
53
+ "gitHead": "f67cb5a86aa108dfdb3bc28078b07824dd93e60d"
54
54
  }