@textbus/adapter-react 4.2.0 → 4.2.1

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,6 +1,7 @@
1
- import { makeError, VElement, VTextNode } from '@textbus/core';
1
+ 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
+ import { ReflectiveInjector } from '@viewfly/core';
4
5
 
5
6
  const adapterError = makeError('ReactAdapter');
6
7
  class ReactAdapter extends DomAdapter {
@@ -114,6 +115,19 @@ class ReactAdapter extends DomAdapter {
114
115
  };
115
116
  });
116
117
  }
118
+ render(rootComponent, injector) {
119
+ const childInjector = new ReflectiveInjector(injector, [{
120
+ provide: Adapter,
121
+ useValue: this
122
+ }, {
123
+ provide: DomAdapter,
124
+ useValue: this
125
+ }, {
126
+ provide: ReactAdapter,
127
+ useValue: this
128
+ }]);
129
+ return super.render(rootComponent, childInjector);
130
+ }
117
131
  copy() {
118
132
  document.execCommand('copy');
119
133
  }
package/bundles/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  var core = require('@textbus/core');
4
4
  var platformBrowser = require('@textbus/platform-browser');
5
5
  var react = require('react');
6
+ var core$1 = require('@viewfly/core');
6
7
 
7
8
  const adapterError = core.makeError('ReactAdapter');
8
9
  class ReactAdapter extends platformBrowser.DomAdapter {
@@ -116,6 +117,19 @@ class ReactAdapter extends platformBrowser.DomAdapter {
116
117
  };
117
118
  });
118
119
  }
120
+ render(rootComponent, injector) {
121
+ const childInjector = new core$1.ReflectiveInjector(injector, [{
122
+ provide: core.Adapter,
123
+ useValue: this
124
+ }, {
125
+ provide: platformBrowser.DomAdapter,
126
+ useValue: this
127
+ }, {
128
+ provide: ReactAdapter,
129
+ useValue: this
130
+ }]);
131
+ return super.render(rootComponent, childInjector);
132
+ }
119
133
  copy() {
120
134
  document.execCommand('copy');
121
135
  }
@@ -1,6 +1,7 @@
1
1
  import { Component, ViewMount } from '@textbus/core';
2
2
  import { DomAdapter } from '@textbus/platform-browser';
3
3
  import { JSX } from 'react';
4
+ import { Injector } from '@viewfly/core';
4
5
  export interface ViewComponentProps<T extends Component> {
5
6
  component: T;
6
7
  rootRef: ((rootNode: Element) => void);
@@ -11,5 +12,6 @@ export interface ReactAdapterComponents {
11
12
  export declare class ReactAdapter extends DomAdapter<JSX.Element, JSX.Element> {
12
13
  private components;
13
14
  constructor(components: ReactAdapterComponents, mount: ViewMount<JSX.Element, Element>);
15
+ render(rootComponent: Component, injector: Injector): void | (() => void);
14
16
  copy(): void;
15
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/adapter-react",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
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.5",
29
- "@textbus/core": "^4.2.0",
30
- "@textbus/platform-browser": "^4.2.0",
29
+ "@textbus/core": "^4.2.1",
30
+ "@textbus/platform-browser": "^4.2.1",
31
31
  "react": "^17.0.0 || ^18.0.0"
32
32
  },
33
33
  "devDependencies": {