@textbus/collaborate 3.0.0-alpha.3 → 3.0.0-alpha.30
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 +75 -77
- package/bundles/index.esm.js +730 -0
- package/bundles/index.js +732 -0
- package/bundles/public-api.d.ts +3 -4
- package/package.json +14 -8
- package/bundles/collaborate-cursor.d.ts +0 -42
- package/bundles/collaborate-cursor.js +0 -273
- package/bundles/collaborate.js +0 -713
- package/bundles/public-api.js +0 -16
- package/bundles/unknown.component.d.ts +0 -1
- package/bundles/unknown.component.js +0 -22
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,77 +1,75 @@
|
|
1
|
-
import { Observable, Subject, Subscription } from '@tanbo/stream';
|
2
|
-
import { ComponentInstance, Controller, Factory, 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 } from 'yjs';
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
set(key:
|
13
|
-
|
14
|
-
get(key:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
protected
|
24
|
-
protected
|
25
|
-
protected
|
26
|
-
protected
|
27
|
-
protected
|
28
|
-
protected
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
protected
|
40
|
-
protected
|
41
|
-
protected
|
42
|
-
protected
|
43
|
-
protected
|
44
|
-
protected
|
45
|
-
protected
|
46
|
-
protected
|
47
|
-
protected
|
48
|
-
protected
|
49
|
-
protected
|
50
|
-
protected
|
51
|
-
protected
|
52
|
-
protected
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
protected
|
62
|
-
protected
|
63
|
-
protected
|
64
|
-
protected
|
65
|
-
protected
|
66
|
-
protected
|
67
|
-
protected
|
68
|
-
protected
|
69
|
-
protected
|
70
|
-
protected
|
71
|
-
protected
|
72
|
-
protected
|
73
|
-
protected
|
74
|
-
|
75
|
-
|
76
|
-
}
|
77
|
-
export {};
|
1
|
+
import { Observable, Subject, Subscription } from '@tanbo/stream';
|
2
|
+
import { ComponentInstance, Controller, Factory, 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 } 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 class Collaborate implements History {
|
22
|
+
protected stackSize: number;
|
23
|
+
protected rootComponentRef: RootComponentRef;
|
24
|
+
protected controller: Controller;
|
25
|
+
protected scheduler: Scheduler;
|
26
|
+
protected factory: Factory;
|
27
|
+
protected selection: Selection;
|
28
|
+
protected starter: Starter;
|
29
|
+
onLocalChangesApplied: Observable<void>;
|
30
|
+
yDoc: YDoc;
|
31
|
+
onBack: Observable<void>;
|
32
|
+
onForward: Observable<void>;
|
33
|
+
onChange: Observable<void>;
|
34
|
+
onPush: Observable<void>;
|
35
|
+
get canBack(): boolean;
|
36
|
+
get canForward(): boolean;
|
37
|
+
protected backEvent: Subject<void>;
|
38
|
+
protected forwardEvent: Subject<void>;
|
39
|
+
protected changeEvent: Subject<void>;
|
40
|
+
protected pushEvent: Subject<void>;
|
41
|
+
protected manager: UndoManager | null;
|
42
|
+
protected subscriptions: Subscription[];
|
43
|
+
protected updateFromRemote: boolean;
|
44
|
+
protected contentSyncCaches: WeakMap<Slot<any>, () => void>;
|
45
|
+
protected slotStateSyncCaches: WeakMap<Slot<any>, () => void>;
|
46
|
+
protected slotsSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
|
47
|
+
protected componentStateSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
|
48
|
+
protected localChangesAppliedEvent: Subject<void>;
|
49
|
+
protected selectionChangeEvent: Subject<SelectionPaths>;
|
50
|
+
protected contentMap: ContentMap;
|
51
|
+
protected updateRemoteActions: Array<UpdateItem>;
|
52
|
+
protected noRecord: {};
|
53
|
+
constructor(stackSize: number, rootComponentRef: RootComponentRef, controller: Controller, scheduler: Scheduler, factory: Factory, selection: Selection, starter: Starter);
|
54
|
+
listen(): void;
|
55
|
+
back(): void;
|
56
|
+
forward(): void;
|
57
|
+
clear(): void;
|
58
|
+
destroy(): void;
|
59
|
+
protected syncRootComponent(root: YMap<any>, rootComponent: ComponentInstance): void;
|
60
|
+
protected restoreCursorLocation(position: CursorPosition): void;
|
61
|
+
protected getRelativeCursorLocation(): CursorPosition | null;
|
62
|
+
protected syncSlotContent(content: YText, slot: Slot): void;
|
63
|
+
protected syncSlotState(remoteSlot: YMap<any>, slot: Slot): void;
|
64
|
+
protected syncComponentSlots(remoteSlots: YArray<any>, component: ComponentInstance): void;
|
65
|
+
protected syncComponentState(remoteComponent: YMap<any>, component: ComponentInstance): void;
|
66
|
+
protected runLocalUpdate(fn: () => void, record?: boolean): void;
|
67
|
+
protected runRemoteUpdate(tr: Transaction, fn: () => void): void;
|
68
|
+
protected createSharedComponentByComponent(component: ComponentInstance): YMap<any>;
|
69
|
+
protected createSharedSlotBySlot(slot: Slot): YMap<any>;
|
70
|
+
protected createComponentBySharedComponent(yMap: YMap<any>): ComponentInstance;
|
71
|
+
protected createSlotBySharedSlot(sharedSlot: YMap<any>): Slot;
|
72
|
+
protected cleanSubscriptionsBySlot(slot: Slot): void;
|
73
|
+
protected cleanSubscriptionsByComponent(component: ComponentInstance): void;
|
74
|
+
}
|
75
|
+
export {};
|