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