@textbus/platform-browser 4.0.0-alpha.5 → 4.0.0-alpha.50
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/README.md +0 -114
- package/bundles/browser-module.d.ts +22 -7
- package/bundles/collaborate-cursor.d.ts +7 -13
- package/bundles/dom-adapter.d.ts +4 -64
- package/bundles/index.esm.js +169 -226
- package/bundles/index.js +171 -228
- package/bundles/magic-input.d.ts +9 -9
- package/bundles/native-input.d.ts +3 -5
- package/bundles/parser.d.ts +10 -11
- package/bundles/public-api.d.ts +1 -0
- package/bundles/selection-bridge.d.ts +3 -4
- package/bundles/types.d.ts +0 -7
- package/package.json +6 -5
package/bundles/magic-input.d.ts
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
import { Observable } from '@tanbo/stream';
|
2
|
-
import {
|
3
|
-
import { Commander, Controller, Keyboard, Scheduler, Selection } from '@textbus/core';
|
2
|
+
import { Commander, Controller, Keyboard, Scheduler, Selection, Textbus } from '@textbus/core';
|
4
3
|
import { Parser } from './parser';
|
5
|
-
import { Caret, CaretPosition,
|
4
|
+
import { Caret, CaretPosition, Input, Scroller } from './types';
|
5
|
+
import { DomAdapter } from './dom-adapter';
|
6
6
|
interface CaretStyle {
|
7
7
|
height: string;
|
8
8
|
lineHeight: string;
|
9
9
|
fontSize: string;
|
10
10
|
}
|
11
11
|
declare class ExperimentalCaret implements Caret {
|
12
|
+
private domRenderer;
|
12
13
|
private scheduler;
|
13
14
|
private editorMask;
|
14
15
|
onPositionChange: Observable<CaretPosition | null>;
|
15
16
|
onStyleChange: Observable<CaretStyle>;
|
16
17
|
elementRef: HTMLElement;
|
17
|
-
compositionState: CompositionState | null;
|
18
18
|
get rect(): DOMRect;
|
19
|
-
compositionElement: HTMLElement;
|
20
19
|
private timer;
|
21
20
|
private caret;
|
22
21
|
private oldPosition;
|
@@ -30,7 +29,7 @@ declare class ExperimentalCaret implements Caret {
|
|
30
29
|
private styleChangeEvent;
|
31
30
|
private oldRange;
|
32
31
|
private isFixed;
|
33
|
-
constructor(scheduler: Scheduler, editorMask: HTMLElement);
|
32
|
+
constructor(domRenderer: DomAdapter, scheduler: Scheduler, editorMask: HTMLElement);
|
34
33
|
refresh(isFixedCaret?: boolean): void;
|
35
34
|
show(range: Range, restart: boolean): void;
|
36
35
|
hide(): void;
|
@@ -42,15 +41,15 @@ declare class ExperimentalCaret implements Caret {
|
|
42
41
|
* Textbus PC 端输入实现
|
43
42
|
*/
|
44
43
|
export declare class MagicInput extends Input {
|
44
|
+
private domAdapter;
|
45
45
|
private parser;
|
46
46
|
private keyboard;
|
47
47
|
private commander;
|
48
48
|
private selection;
|
49
49
|
private controller;
|
50
50
|
private scheduler;
|
51
|
-
private
|
51
|
+
private textbus;
|
52
52
|
composition: boolean;
|
53
|
-
compositionState: CompositionState | null;
|
54
53
|
onReady: Promise<void>;
|
55
54
|
caret: ExperimentalCaret;
|
56
55
|
set disabled(b: boolean);
|
@@ -67,10 +66,11 @@ export declare class MagicInput extends Input {
|
|
67
66
|
private isFocus;
|
68
67
|
private nativeFocus;
|
69
68
|
private ignoreComposition;
|
70
|
-
constructor(parser: Parser, keyboard: Keyboard, commander: Commander, selection: Selection, controller: Controller, scheduler: Scheduler,
|
69
|
+
constructor(domAdapter: DomAdapter, parser: Parser, keyboard: Keyboard, commander: Commander, selection: Selection, controller: Controller, scheduler: Scheduler, textbus: Textbus);
|
71
70
|
focus(range: Range, restart: boolean): void;
|
72
71
|
blur(): void;
|
73
72
|
destroy(): void;
|
73
|
+
private reInit;
|
74
74
|
private init;
|
75
75
|
private handleDefaultActions;
|
76
76
|
private handlePaste;
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import { Injector } from '@viewfly/core';
|
2
1
|
import { Observable } from '@tanbo/stream';
|
3
|
-
import { Commander, Controller, Keyboard, Scheduler, Selection } from '@textbus/core';
|
4
|
-
import { Caret, CaretPosition,
|
2
|
+
import { Commander, Controller, Keyboard, Scheduler, Selection, Textbus } from '@textbus/core';
|
3
|
+
import { Caret, CaretPosition, Input, Scroller } from './types';
|
5
4
|
import { Parser } from './parser';
|
6
5
|
import { DomAdapter } from './dom-adapter';
|
7
6
|
declare class NativeCaret implements Caret {
|
@@ -29,7 +28,6 @@ export declare class NativeInput extends Input {
|
|
29
28
|
private controller;
|
30
29
|
caret: NativeCaret;
|
31
30
|
composition: boolean;
|
32
|
-
compositionState: CompositionState | null;
|
33
31
|
onReady: Promise<void>;
|
34
32
|
set disabled(b: boolean);
|
35
33
|
get disabled(): boolean;
|
@@ -42,7 +40,7 @@ export declare class NativeInput extends Input {
|
|
42
40
|
private isMac;
|
43
41
|
private isMobileBrowser;
|
44
42
|
private ignoreComposition;
|
45
|
-
constructor(
|
43
|
+
constructor(textbus: Textbus, parser: Parser, scheduler: Scheduler, selection: Selection, keyboard: Keyboard, domAdapter: DomAdapter, commander: Commander, controller: Controller);
|
46
44
|
focus(nativeRange: Range): void;
|
47
45
|
blur(): void;
|
48
46
|
destroy(): void;
|
package/bundles/parser.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import { Attribute, ComponentInstance, Formatter, FormatValue, Slot } from '@textbus/core';
|
1
|
+
import { Attribute, Component, Formatter, FormatValue, Slot, Textbus } from '@textbus/core';
|
3
2
|
import { ViewOptions } from './browser-module';
|
4
3
|
/**
|
5
4
|
* 插槽解析器
|
@@ -21,16 +20,16 @@ export interface ComponentLoader {
|
|
21
20
|
/** 识别组件的匹配方法 */
|
22
21
|
match(element: HTMLElement): boolean;
|
23
22
|
/** 读取组件内容的方法 */
|
24
|
-
read(element: HTMLElement,
|
23
|
+
read(element: HTMLElement, textbus: Textbus, slotParser: SlotParser): Component | Slot | void;
|
25
24
|
}
|
26
|
-
export interface FormatLoaderReadResult<T
|
25
|
+
export interface FormatLoaderReadResult<T = FormatValue> {
|
27
26
|
formatter: Formatter<T>;
|
28
27
|
value: T;
|
29
28
|
}
|
30
29
|
/**
|
31
30
|
* 格式加载器
|
32
31
|
*/
|
33
|
-
export interface FormatLoader<T
|
32
|
+
export interface FormatLoader<T = FormatValue> {
|
34
33
|
/**
|
35
34
|
* 匹配一个 DOM 节点是否是某个格式节点
|
36
35
|
* @param element
|
@@ -42,14 +41,14 @@ export interface FormatLoader<T extends FormatValue> {
|
|
42
41
|
*/
|
43
42
|
read(element: HTMLElement): FormatLoaderReadResult<T>;
|
44
43
|
}
|
45
|
-
export interface AttributeLoaderReadResult<T
|
44
|
+
export interface AttributeLoaderReadResult<T = FormatValue> {
|
46
45
|
attribute: Attribute<T>;
|
47
46
|
value: T;
|
48
47
|
}
|
49
48
|
/**
|
50
49
|
* 属性加载器
|
51
50
|
*/
|
52
|
-
export interface AttributeLoader<T
|
51
|
+
export interface AttributeLoader<T = FormatValue> {
|
53
52
|
/**
|
54
53
|
* 匹配一个 DOM 节点是否是某个属性节点
|
55
54
|
* @param element
|
@@ -66,24 +65,24 @@ export interface AttributeLoader<T extends FormatValue> {
|
|
66
65
|
*/
|
67
66
|
export declare class Parser {
|
68
67
|
private options;
|
69
|
-
private
|
68
|
+
private textbus;
|
70
69
|
static parseHTML(html: string): HTMLElement;
|
71
70
|
componentLoaders: ComponentLoader[];
|
72
71
|
formatLoaders: FormatLoader<any>[];
|
73
72
|
attributeLoaders: AttributeLoader<any>[];
|
74
|
-
constructor(options: ViewOptions,
|
73
|
+
constructor(options: ViewOptions, textbus: Textbus);
|
75
74
|
/**
|
76
75
|
* 使用指定的组件加载器解析一段 HTML 字符串或 DOM 元素
|
77
76
|
* @param html
|
78
77
|
* @param rootComponentLoader
|
79
78
|
*/
|
80
|
-
parseDoc(html: string | HTMLElement, rootComponentLoader: ComponentLoader): void | Slot
|
79
|
+
parseDoc(html: string | HTMLElement, rootComponentLoader: ComponentLoader): void | Slot | Component<import("@textbus/core").State>;
|
81
80
|
/**
|
82
81
|
* 将一段 HTML 或 DOM 元素解析到指定插槽
|
83
82
|
* @param html
|
84
83
|
* @param rootSlot
|
85
84
|
*/
|
86
|
-
parse(html: string | HTMLElement, rootSlot: Slot): Slot
|
85
|
+
parse(html: string | HTMLElement, rootSlot: Slot): Slot;
|
87
86
|
private readComponent;
|
88
87
|
private readText;
|
89
88
|
private readFormats;
|
package/bundles/public-api.d.ts
CHANGED
@@ -6,6 +6,7 @@ export * from './collaborate-cursor';
|
|
6
6
|
export * from './dom-adapter';
|
7
7
|
export * from './injection-tokens';
|
8
8
|
export * from './magic-input';
|
9
|
+
export * from './native-input';
|
9
10
|
export * from './parser';
|
10
11
|
export * from './selection-bridge';
|
11
12
|
export * from './types';
|
@@ -1,10 +1,9 @@
|
|
1
1
|
import { Observable } from '@tanbo/stream';
|
2
|
-
import {
|
3
|
-
import { NativeSelectionBridge, NativeSelectionConnector, SelectionPosition, AbstractSelection, RootComponentRef, Controller, Selection } from '@textbus/core';
|
2
|
+
import { NativeSelectionBridge, NativeSelectionConnector, SelectionPosition, AbstractSelection, RootComponentRef, Controller, Selection, Textbus } from '@textbus/core';
|
4
3
|
import { Rect } from './_utils/uikit';
|
5
4
|
import { Input } from './types';
|
6
|
-
import { DomAdapter } from './dom-adapter';
|
7
5
|
import { ViewOptions } from './browser-module';
|
6
|
+
import { DomAdapter } from './dom-adapter';
|
8
7
|
/**
|
9
8
|
* Textbus PC 端选区桥接实现
|
10
9
|
*/
|
@@ -25,7 +24,7 @@ export declare class SelectionBridge implements NativeSelectionBridge {
|
|
25
24
|
private docContainer;
|
26
25
|
private cacheCaretPositionTimer;
|
27
26
|
private oldCaretPosition;
|
28
|
-
constructor(config: ViewOptions,
|
27
|
+
constructor(config: ViewOptions, textbus: Textbus, controller: Controller, selection: Selection, rootComponentRef: RootComponentRef, input: Input, domAdapter: DomAdapter);
|
29
28
|
connect(connector: NativeSelectionConnector): void;
|
30
29
|
disConnect(): void;
|
31
30
|
getRect(location: SelectionPosition): Rect | null;
|
package/bundles/types.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import { Slot } from '@textbus/core';
|
2
1
|
import { Observable } from '@tanbo/stream';
|
3
2
|
import { Rect } from './_utils/uikit';
|
4
3
|
export interface CaretLimit {
|
@@ -21,11 +20,6 @@ export interface Caret {
|
|
21
20
|
refresh(isFixedCaret: boolean): void;
|
22
21
|
correctScrollTop(scroller: Scroller): void;
|
23
22
|
}
|
24
|
-
export interface CompositionState {
|
25
|
-
slot: Slot;
|
26
|
-
index: number;
|
27
|
-
data: string;
|
28
|
-
}
|
29
23
|
export declare abstract class Input {
|
30
24
|
/**
|
31
25
|
* @experimental
|
@@ -34,7 +28,6 @@ export declare abstract class Input {
|
|
34
28
|
/**
|
35
29
|
* @experimental
|
36
30
|
*/
|
37
|
-
abstract compositionState: CompositionState | null;
|
38
31
|
abstract onReady: Promise<void>;
|
39
32
|
abstract caret: Caret;
|
40
33
|
abstract disabled: boolean;
|
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.50",
|
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",
|
@@ -25,9 +25,10 @@
|
|
25
25
|
"typescript editor"
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
|
-
"@tanbo/stream": "^1.2.
|
29
|
-
"@textbus/
|
30
|
-
"@
|
28
|
+
"@tanbo/stream": "^1.2.3",
|
29
|
+
"@textbus/collaborate": "^4.0.0-alpha.50",
|
30
|
+
"@textbus/core": "^4.0.0-alpha.50",
|
31
|
+
"@viewfly/core": "^1.0.0-alpha.4",
|
31
32
|
"reflect-metadata": "^0.1.13"
|
32
33
|
},
|
33
34
|
"devDependencies": {
|
@@ -48,5 +49,5 @@
|
|
48
49
|
"bugs": {
|
49
50
|
"url": "https://github.com/textbus/textbus.git/issues"
|
50
51
|
},
|
51
|
-
"gitHead": "
|
52
|
+
"gitHead": "a7918554368f01ea704bedb8750a7513602aae49"
|
52
53
|
}
|