@textbus/collaborate 3.1.7 → 3.1.14
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +674 -674
- package/README.md +11 -11
- package/bundles/collaborate.d.ts +86 -82
- package/bundles/index.esm.js +745 -735
- package/bundles/index.js +745 -735
- package/bundles/public-api.d.ts +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
Textbus
|
2
|
-
=====================
|
3
|
-
|
4
|
-
Textbus 是一套用于构建富交互的富文本编辑框架。和大多数富文本编辑器不同的是,Textbus 以组件为核心,格式为辅助,并大幅简化了富文本编辑器开发中常见
|
5
|
-
API,且提供了更高的抽象层,使 Textbus 不仅易于上手,同时还能驱动复杂的富文本应用。
|
6
|
-
|
7
|
-
本项目为 Textbus 协作编辑实现,提供了多人在线协作编辑能力的支持。
|
8
|
-
|
9
|
-
### 文档
|
10
|
-
|
11
|
-
更多文档请参考:[中文文档](https://textbus.io)
|
1
|
+
Textbus
|
2
|
+
=====================
|
3
|
+
|
4
|
+
Textbus 是一套用于构建富交互的富文本编辑框架。和大多数富文本编辑器不同的是,Textbus 以组件为核心,格式为辅助,并大幅简化了富文本编辑器开发中常见
|
5
|
+
API,且提供了更高的抽象层,使 Textbus 不仅易于上手,同时还能驱动复杂的富文本应用。
|
6
|
+
|
7
|
+
本项目为 Textbus 协作编辑实现,提供了多人在线协作编辑能力的支持。
|
8
|
+
|
9
|
+
### 文档
|
10
|
+
|
11
|
+
更多文档请参考:[中文文档](https://textbus.io)
|
package/bundles/collaborate.d.ts
CHANGED
@@ -1,82 +1,86 @@
|
|
1
|
-
import { Observable, Subject, Subscription } from '@tanbo/stream';
|
2
|
-
import { AbstractSelection, ComponentInstance, Controller, Registry, History, RootComponentRef, Scheduler, Selection, SelectionPaths, Slot, Starter } from '@textbus/core';
|
3
|
-
import { Array as YArray, Doc as YDoc, Map as YMap, RelativePosition, Text as YText, Transaction, UndoManager, Item } from 'yjs';
|
4
|
-
interface CursorPosition {
|
5
|
-
anchor: RelativePosition;
|
6
|
-
focus: RelativePosition;
|
7
|
-
}
|
8
|
-
declare class ContentMap {
|
9
|
-
private slotAndYTextMap;
|
10
|
-
private yTextAndSLotMap;
|
11
|
-
set(key: Slot, value: YText): void;
|
12
|
-
set(key: YText, value: Slot): void;
|
13
|
-
get(key: Slot): YText | null;
|
14
|
-
get(key: YText): Slot | null;
|
15
|
-
delete(key: Slot | YText): void;
|
16
|
-
}
|
17
|
-
interface UpdateItem {
|
18
|
-
record: boolean;
|
19
|
-
action(): void;
|
20
|
-
}
|
21
|
-
export declare abstract class CustomUndoManagerConfig {
|
22
|
-
abstract captureTransaction?(arg0: Transaction): boolean;
|
23
|
-
abstract deleteFilter?(arg0: Item): boolean;
|
24
|
-
}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
protected
|
31
|
-
protected
|
32
|
-
protected
|
33
|
-
protected
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
protected
|
47
|
-
protected
|
48
|
-
protected
|
49
|
-
protected
|
50
|
-
protected
|
51
|
-
protected
|
52
|
-
protected
|
53
|
-
protected
|
54
|
-
protected
|
55
|
-
protected
|
56
|
-
protected
|
57
|
-
protected
|
58
|
-
protected
|
59
|
-
protected
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
protected
|
71
|
-
protected
|
72
|
-
protected
|
73
|
-
protected
|
74
|
-
protected
|
75
|
-
protected
|
76
|
-
protected
|
77
|
-
protected
|
78
|
-
protected
|
79
|
-
protected
|
80
|
-
protected
|
81
|
-
|
82
|
-
|
1
|
+
import { Observable, Subject, Subscription } from '@tanbo/stream';
|
2
|
+
import { AbstractSelection, ComponentInstance, Controller, Registry, History, RootComponentRef, Scheduler, Selection, SelectionPaths, Slot, Starter } from '@textbus/core';
|
3
|
+
import { Array as YArray, Doc as YDoc, Map as YMap, RelativePosition, Text as YText, Transaction, UndoManager, Item } from 'yjs';
|
4
|
+
interface CursorPosition {
|
5
|
+
anchor: RelativePosition;
|
6
|
+
focus: RelativePosition;
|
7
|
+
}
|
8
|
+
declare class ContentMap {
|
9
|
+
private slotAndYTextMap;
|
10
|
+
private yTextAndSLotMap;
|
11
|
+
set(key: Slot, value: YText): void;
|
12
|
+
set(key: YText, value: Slot): void;
|
13
|
+
get(key: Slot): YText | null;
|
14
|
+
get(key: YText): Slot | null;
|
15
|
+
delete(key: Slot | YText): void;
|
16
|
+
}
|
17
|
+
interface UpdateItem {
|
18
|
+
record: boolean;
|
19
|
+
action(): void;
|
20
|
+
}
|
21
|
+
export declare abstract class CustomUndoManagerConfig {
|
22
|
+
abstract captureTransaction?(arg0: Transaction): boolean;
|
23
|
+
abstract deleteFilter?(arg0: Item): boolean;
|
24
|
+
}
|
25
|
+
interface CollaborateHistorySelectionPosition {
|
26
|
+
before: CursorPosition | null;
|
27
|
+
after: CursorPosition | null;
|
28
|
+
}
|
29
|
+
export declare class Collaborate implements History {
|
30
|
+
protected stackSize: number;
|
31
|
+
protected rootComponentRef: RootComponentRef;
|
32
|
+
protected controller: Controller;
|
33
|
+
protected scheduler: Scheduler;
|
34
|
+
protected registry: Registry;
|
35
|
+
protected selection: Selection;
|
36
|
+
protected starter: Starter;
|
37
|
+
protected undoManagerConfig: CustomUndoManagerConfig;
|
38
|
+
onLocalChangesApplied: Observable<void>;
|
39
|
+
yDoc: YDoc;
|
40
|
+
onBack: Observable<void>;
|
41
|
+
onForward: Observable<void>;
|
42
|
+
onChange: Observable<void>;
|
43
|
+
onPush: Observable<void>;
|
44
|
+
get canBack(): boolean;
|
45
|
+
get canForward(): boolean;
|
46
|
+
protected backEvent: Subject<void>;
|
47
|
+
protected forwardEvent: Subject<void>;
|
48
|
+
protected changeEvent: Subject<void>;
|
49
|
+
protected pushEvent: Subject<void>;
|
50
|
+
protected manager: UndoManager | null;
|
51
|
+
protected subscriptions: Subscription[];
|
52
|
+
protected updateFromRemote: boolean;
|
53
|
+
protected contentSyncCaches: WeakMap<Slot<any>, () => void>;
|
54
|
+
protected slotStateSyncCaches: WeakMap<Slot<any>, () => void>;
|
55
|
+
protected slotsSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
|
56
|
+
protected componentStateSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
|
57
|
+
protected localChangesAppliedEvent: Subject<void>;
|
58
|
+
protected selectionChangeEvent: Subject<SelectionPaths>;
|
59
|
+
protected contentMap: ContentMap;
|
60
|
+
protected updateRemoteActions: Array<UpdateItem>;
|
61
|
+
protected noRecord: {};
|
62
|
+
protected historyItems: Array<CollaborateHistorySelectionPosition>;
|
63
|
+
protected index: number;
|
64
|
+
constructor(stackSize: number, rootComponentRef: RootComponentRef, controller: Controller, scheduler: Scheduler, registry: Registry, selection: Selection, starter: Starter, undoManagerConfig: CustomUndoManagerConfig);
|
65
|
+
listen(): void;
|
66
|
+
back(): void;
|
67
|
+
forward(): void;
|
68
|
+
clear(): void;
|
69
|
+
destroy(): void;
|
70
|
+
protected syncRootComponent(root: YMap<any>, rootComponent: ComponentInstance): void;
|
71
|
+
protected getAbstractSelection(position: CursorPosition): AbstractSelection | null;
|
72
|
+
protected getRelativeCursorLocation(): CursorPosition | null;
|
73
|
+
protected syncSlotContent(content: YText, slot: Slot): void;
|
74
|
+
protected syncSlotState(remoteSlot: YMap<any>, slot: Slot): void;
|
75
|
+
protected syncComponentSlots(remoteSlots: YArray<any>, component: ComponentInstance): void;
|
76
|
+
protected syncComponentState(remoteComponent: YMap<any>, component: ComponentInstance): void;
|
77
|
+
protected runLocalUpdate(fn: () => void, record?: boolean): void;
|
78
|
+
protected runRemoteUpdate(tr: Transaction, fn: () => void): void;
|
79
|
+
protected createSharedComponentByComponent(component: ComponentInstance): YMap<any>;
|
80
|
+
protected createSharedSlotBySlot(slot: Slot): YMap<any>;
|
81
|
+
protected createComponentBySharedComponent(yMap: YMap<any>): ComponentInstance;
|
82
|
+
protected createSlotBySharedSlot(sharedSlot: YMap<any>): Slot;
|
83
|
+
protected cleanSubscriptionsBySlot(slot: Slot): void;
|
84
|
+
protected cleanSubscriptionsByComponent(component: ComponentInstance): void;
|
85
|
+
}
|
86
|
+
export {};
|