@textbus/adapter-react 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.
@@ -2,6 +2,7 @@ import { makeError, VElement, VTextNode, Adapter } from '@textbus/core';
2
2
  import { DomAdapter } from '@textbus/platform-browser';
3
3
  import { createElement, useState, useEffect } from 'react';
4
4
  import { ReflectiveInjector } from '@viewfly/core';
5
+ import { merge } from '@tanbo/stream';
5
6
 
6
7
  const adapterError = makeError('ReactAdapter');
7
8
  class ReactAdapter extends DomAdapter {
@@ -76,13 +77,18 @@ class ReactAdapter extends DomAdapter {
76
77
  return createElement(vNode.tagName, props, ...children);
77
78
  }
78
79
  }, mount);
79
- this.components = {};
80
+ Object.defineProperty(this, "components", {
81
+ enumerable: true,
82
+ configurable: true,
83
+ writable: true,
84
+ value: {}
85
+ });
80
86
  Object.keys(components).forEach(key => {
81
87
  this.components[key] = (props) => {
82
88
  const component = props.component;
83
89
  const [updateKey, refreshUpdateKey] = useState(Math.random());
84
90
  useEffect(() => {
85
- const sub = component.changeMarker.onChange.subscribe(() => {
91
+ const sub = merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {
86
92
  if (component.changeMarker.dirty) {
87
93
  refreshUpdateKey(Math.random());
88
94
  }
package/bundles/index.js CHANGED
@@ -4,6 +4,7 @@ var core = require('@textbus/core');
4
4
  var platformBrowser = require('@textbus/platform-browser');
5
5
  var react = require('react');
6
6
  var core$1 = require('@viewfly/core');
7
+ var stream = require('@tanbo/stream');
7
8
 
8
9
  const adapterError = core.makeError('ReactAdapter');
9
10
  class ReactAdapter extends platformBrowser.DomAdapter {
@@ -78,13 +79,18 @@ class ReactAdapter extends platformBrowser.DomAdapter {
78
79
  return react.createElement(vNode.tagName, props, ...children);
79
80
  }
80
81
  }, mount);
81
- this.components = {};
82
+ Object.defineProperty(this, "components", {
83
+ enumerable: true,
84
+ configurable: true,
85
+ writable: true,
86
+ value: {}
87
+ });
82
88
  Object.keys(components).forEach(key => {
83
89
  this.components[key] = (props) => {
84
90
  const component = props.component;
85
91
  const [updateKey, refreshUpdateKey] = react.useState(Math.random());
86
92
  react.useEffect(() => {
87
- const sub = component.changeMarker.onChange.subscribe(() => {
93
+ const sub = stream.merge(component.changeMarker.onChange, component.changeMarker.onForceChange).subscribe(() => {
88
94
  if (component.changeMarker.dirty) {
89
95
  refreshUpdateKey(Math.random());
90
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/adapter-react",
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,8 +26,8 @@
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",
29
+ "@textbus/core": "^4.3.5",
30
+ "@textbus/platform-browser": "^4.3.5",
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": "d07e5acf88c96bb8eb37760fd71ccc00ae5d3f5b"
52
+ "gitHead": "f67cb5a86aa108dfdb3bc28078b07824dd93e60d"
53
53
  }