@textbus/platform-browser 4.0.0-alpha.17 → 4.0.0-alpha.19
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/browser-module.d.ts +5 -3
- package/bundles/index.esm.js +11 -6
- package/bundles/index.js +11 -6
- package/package.json +4 -4
@@ -6,7 +6,10 @@ import { DomAdapter } from './dom-adapter';
|
|
6
6
|
* Textbus PC 端配置接口
|
7
7
|
*/
|
8
8
|
export interface ViewOptions {
|
9
|
+
/** 渲染平台适配器 */
|
9
10
|
adapter: DomAdapter<any, any>;
|
11
|
+
/** 编辑器根节点 */
|
12
|
+
renderTo(): HTMLElement;
|
10
13
|
/** 自动获取焦点 */
|
11
14
|
autoFocus?: boolean;
|
12
15
|
/** 编辑区最小高度 */
|
@@ -21,11 +24,10 @@ export interface ViewOptions {
|
|
21
24
|
useContentEditable?: boolean;
|
22
25
|
}
|
23
26
|
export declare class BrowserModule implements Module {
|
24
|
-
host: HTMLElement;
|
25
27
|
config: ViewOptions;
|
26
28
|
providers: Provider[];
|
27
29
|
private workbench;
|
28
|
-
constructor(
|
30
|
+
constructor(config: ViewOptions);
|
29
31
|
/**
|
30
32
|
* 解析 HTML 并返回一个组件实例
|
31
33
|
* @param html 要解析的 HTML
|
@@ -40,7 +42,7 @@ export declare class BrowserModule implements Module {
|
|
40
42
|
* @param textbus
|
41
43
|
*/
|
42
44
|
readDocumentByComponentLiteral(data: ComponentLiteral, rootComponent: Component, textbus: Textbus): ComponentInstance;
|
45
|
+
setup(): () => void;
|
43
46
|
onAfterStartup(textbus: Textbus): void;
|
44
|
-
onDestroy(): void;
|
45
47
|
private static createLayout;
|
46
48
|
}
|
package/bundles/index.esm.js
CHANGED
@@ -2297,8 +2297,7 @@ NativeInput = __decorate([
|
|
2297
2297
|
|
2298
2298
|
const browserErrorFn = makeError('BrowserModule');
|
2299
2299
|
class BrowserModule {
|
2300
|
-
constructor(
|
2301
|
-
this.host = host;
|
2300
|
+
constructor(config) {
|
2302
2301
|
this.config = config;
|
2303
2302
|
const { mask, wrapper } = BrowserModule.createLayout();
|
2304
2303
|
wrapper.prepend(config.adapter.host);
|
@@ -2356,7 +2355,6 @@ class BrowserModule {
|
|
2356
2355
|
SelectionBridge,
|
2357
2356
|
CollaborateCursor];
|
2358
2357
|
this.workbench = wrapper;
|
2359
|
-
this.host.append(wrapper);
|
2360
2358
|
}
|
2361
2359
|
/**
|
2362
2360
|
* 解析 HTML 并返回一个组件实例
|
@@ -2382,14 +2380,21 @@ class BrowserModule {
|
|
2382
2380
|
const registry = textbus.get(Registry);
|
2383
2381
|
return registry.createComponentByFactory(data, rootComponent);
|
2384
2382
|
}
|
2383
|
+
setup() {
|
2384
|
+
const host = this.config.renderTo();
|
2385
|
+
if (!(host instanceof HTMLElement)) {
|
2386
|
+
throw browserErrorFn('view container is not a HTMLElement');
|
2387
|
+
}
|
2388
|
+
host.append(this.workbench);
|
2389
|
+
return () => {
|
2390
|
+
this.workbench.remove();
|
2391
|
+
};
|
2392
|
+
}
|
2385
2393
|
onAfterStartup(textbus) {
|
2386
2394
|
if (this.config.autoFocus) {
|
2387
2395
|
textbus.focus();
|
2388
2396
|
}
|
2389
2397
|
}
|
2390
|
-
onDestroy() {
|
2391
|
-
this.workbench.remove();
|
2392
|
-
}
|
2393
2398
|
static createLayout() {
|
2394
2399
|
const mask = createElement('div', {
|
2395
2400
|
attrs: {
|
package/bundles/index.js
CHANGED
@@ -2299,8 +2299,7 @@ NativeInput = __decorate([
|
|
2299
2299
|
|
2300
2300
|
const browserErrorFn = core$1.makeError('BrowserModule');
|
2301
2301
|
class BrowserModule {
|
2302
|
-
constructor(
|
2303
|
-
this.host = host;
|
2302
|
+
constructor(config) {
|
2304
2303
|
this.config = config;
|
2305
2304
|
const { mask, wrapper } = BrowserModule.createLayout();
|
2306
2305
|
wrapper.prepend(config.adapter.host);
|
@@ -2358,7 +2357,6 @@ class BrowserModule {
|
|
2358
2357
|
exports.SelectionBridge,
|
2359
2358
|
exports.CollaborateCursor];
|
2360
2359
|
this.workbench = wrapper;
|
2361
|
-
this.host.append(wrapper);
|
2362
2360
|
}
|
2363
2361
|
/**
|
2364
2362
|
* 解析 HTML 并返回一个组件实例
|
@@ -2384,14 +2382,21 @@ class BrowserModule {
|
|
2384
2382
|
const registry = textbus.get(core$1.Registry);
|
2385
2383
|
return registry.createComponentByFactory(data, rootComponent);
|
2386
2384
|
}
|
2385
|
+
setup() {
|
2386
|
+
const host = this.config.renderTo();
|
2387
|
+
if (!(host instanceof HTMLElement)) {
|
2388
|
+
throw browserErrorFn('view container is not a HTMLElement');
|
2389
|
+
}
|
2390
|
+
host.append(this.workbench);
|
2391
|
+
return () => {
|
2392
|
+
this.workbench.remove();
|
2393
|
+
};
|
2394
|
+
}
|
2387
2395
|
onAfterStartup(textbus) {
|
2388
2396
|
if (this.config.autoFocus) {
|
2389
2397
|
textbus.focus();
|
2390
2398
|
}
|
2391
2399
|
}
|
2392
|
-
onDestroy() {
|
2393
|
-
this.workbench.remove();
|
2394
|
-
}
|
2395
2400
|
static createLayout() {
|
2396
2401
|
const mask = createElement('div', {
|
2397
2402
|
attrs: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/platform-browser",
|
3
|
-
"version": "4.0.0-alpha.
|
3
|
+
"version": "4.0.0-alpha.19",
|
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.0",
|
29
|
-
"@textbus/core": "^4.0.0-alpha.
|
30
|
-
"@viewfly/core": "^0.
|
29
|
+
"@textbus/core": "^4.0.0-alpha.19",
|
30
|
+
"@viewfly/core": "^0.5.0",
|
31
31
|
"reflect-metadata": "^0.1.13"
|
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": "
|
51
|
+
"gitHead": "7f951b0c4cf33aa7873e26d6e04da5a4301ca066"
|
52
52
|
}
|