@textbus/collaborate 3.0.0-alpha.33 → 3.0.0-alpha.34

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,77 @@
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 } 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 registry: Registry;
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
- protected historyItems: Array<CursorPosition | null>;
54
- protected index: number;
55
- constructor(stackSize: number, rootComponentRef: RootComponentRef, controller: Controller, scheduler: Scheduler, registry: Registry, selection: Selection, starter: Starter);
56
- listen(): void;
57
- back(): void;
58
- forward(): void;
59
- clear(): void;
60
- destroy(): void;
61
- protected syncRootComponent(root: YMap<any>, rootComponent: ComponentInstance): void;
62
- protected getAbstractSelection(position: CursorPosition): AbstractSelection | null;
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>): 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 { 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 } 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 registry: Registry;
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
+ protected historyItems: Array<CursorPosition | null>;
54
+ protected index: number;
55
+ constructor(stackSize: number, rootComponentRef: RootComponentRef, controller: Controller, scheduler: Scheduler, registry: Registry, selection: Selection, starter: Starter);
56
+ listen(): void;
57
+ back(): void;
58
+ forward(): void;
59
+ clear(): void;
60
+ destroy(): void;
61
+ protected syncRootComponent(root: YMap<any>, rootComponent: ComponentInstance): void;
62
+ protected getAbstractSelection(position: CursorPosition): AbstractSelection | null;
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>): ComponentInstance;
73
+ protected createSlotBySharedSlot(sharedSlot: YMap<any>): Slot;
74
+ protected cleanSubscriptionsBySlot(slot: Slot): void;
75
+ protected cleanSubscriptionsByComponent(component: ComponentInstance): void;
76
+ }
77
+ export {};