@textbus/collaborate 3.0.0-y.0 → 3.1.0

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,82 +1,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
- export declare class Collaborate implements History {
26
- protected stackSize: number;
27
- protected rootComponentRef: RootComponentRef;
28
- protected controller: Controller;
29
- protected scheduler: Scheduler;
30
- protected registry: Registry;
31
- protected selection: Selection;
32
- protected starter: Starter;
33
- protected undoManagerConfig: CustomUndoManagerConfig;
34
- onLocalChangesApplied: Observable<void>;
35
- yDoc: YDoc;
36
- onBack: Observable<void>;
37
- onForward: Observable<void>;
38
- onChange: Observable<void>;
39
- onPush: Observable<void>;
40
- get canBack(): boolean;
41
- get canForward(): boolean;
42
- protected backEvent: Subject<void>;
43
- protected forwardEvent: Subject<void>;
44
- protected changeEvent: Subject<void>;
45
- protected pushEvent: Subject<void>;
46
- protected manager: UndoManager | null;
47
- protected subscriptions: Subscription[];
48
- protected updateFromRemote: boolean;
49
- protected contentSyncCaches: WeakMap<Slot<any>, () => void>;
50
- protected slotStateSyncCaches: WeakMap<Slot<any>, () => void>;
51
- protected slotsSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
52
- protected componentStateSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
53
- protected localChangesAppliedEvent: Subject<void>;
54
- protected selectionChangeEvent: Subject<SelectionPaths>;
55
- protected contentMap: ContentMap;
56
- protected updateRemoteActions: Array<UpdateItem>;
57
- protected noRecord: {};
58
- protected historyItems: Array<CursorPosition | null>;
59
- protected index: number;
60
- constructor(stackSize: number, rootComponentRef: RootComponentRef, controller: Controller, scheduler: Scheduler, registry: Registry, selection: Selection, starter: Starter, undoManagerConfig: CustomUndoManagerConfig);
61
- listen(): void;
62
- back(): void;
63
- forward(): void;
64
- clear(): void;
65
- destroy(): void;
66
- protected syncRootComponent(root: YMap<any>, rootComponent: ComponentInstance): void;
67
- protected getAbstractSelection(position: CursorPosition): AbstractSelection | null;
68
- protected getRelativeCursorLocation(): CursorPosition | null;
69
- protected syncSlotContent(content: YText, slot: Slot): void;
70
- protected syncSlotState(remoteSlot: YMap<any>, slot: Slot): void;
71
- protected syncComponentSlots(remoteSlots: YArray<any>, component: ComponentInstance): void;
72
- protected syncComponentState(remoteComponent: YMap<any>, component: ComponentInstance): void;
73
- protected runLocalUpdate(fn: () => void, record?: boolean): void;
74
- protected runRemoteUpdate(tr: Transaction, fn: () => void): void;
75
- protected createSharedComponentByComponent(component: ComponentInstance): YMap<any>;
76
- protected createSharedSlotBySlot(slot: Slot): YMap<any>;
77
- protected createComponentBySharedComponent(yMap: YMap<any>): ComponentInstance;
78
- protected createSlotBySharedSlot(sharedSlot: YMap<any>): Slot;
79
- protected cleanSubscriptionsBySlot(slot: Slot): void;
80
- protected cleanSubscriptionsByComponent(component: ComponentInstance): void;
81
- }
82
- 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, 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
+ export declare class Collaborate implements History {
26
+ protected stackSize: number;
27
+ protected rootComponentRef: RootComponentRef;
28
+ protected controller: Controller;
29
+ protected scheduler: Scheduler;
30
+ protected registry: Registry;
31
+ protected selection: Selection;
32
+ protected starter: Starter;
33
+ protected undoManagerConfig: CustomUndoManagerConfig;
34
+ onLocalChangesApplied: Observable<void>;
35
+ yDoc: YDoc;
36
+ onBack: Observable<void>;
37
+ onForward: Observable<void>;
38
+ onChange: Observable<void>;
39
+ onPush: Observable<void>;
40
+ get canBack(): boolean;
41
+ get canForward(): boolean;
42
+ protected backEvent: Subject<void>;
43
+ protected forwardEvent: Subject<void>;
44
+ protected changeEvent: Subject<void>;
45
+ protected pushEvent: Subject<void>;
46
+ protected manager: UndoManager | null;
47
+ protected subscriptions: Subscription[];
48
+ protected updateFromRemote: boolean;
49
+ protected contentSyncCaches: WeakMap<Slot<any>, () => void>;
50
+ protected slotStateSyncCaches: WeakMap<Slot<any>, () => void>;
51
+ protected slotsSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
52
+ protected componentStateSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
53
+ protected localChangesAppliedEvent: Subject<void>;
54
+ protected selectionChangeEvent: Subject<SelectionPaths>;
55
+ protected contentMap: ContentMap;
56
+ protected updateRemoteActions: Array<UpdateItem>;
57
+ protected noRecord: {};
58
+ protected historyItems: Array<CursorPosition | null>;
59
+ protected index: number;
60
+ constructor(stackSize: number, rootComponentRef: RootComponentRef, controller: Controller, scheduler: Scheduler, registry: Registry, selection: Selection, starter: Starter, undoManagerConfig: CustomUndoManagerConfig);
61
+ listen(): void;
62
+ back(): void;
63
+ forward(): void;
64
+ clear(): void;
65
+ destroy(): void;
66
+ protected syncRootComponent(root: YMap<any>, rootComponent: ComponentInstance): void;
67
+ protected getAbstractSelection(position: CursorPosition): AbstractSelection | null;
68
+ protected getRelativeCursorLocation(): CursorPosition | null;
69
+ protected syncSlotContent(content: YText, slot: Slot): void;
70
+ protected syncSlotState(remoteSlot: YMap<any>, slot: Slot): void;
71
+ protected syncComponentSlots(remoteSlots: YArray<any>, component: ComponentInstance): void;
72
+ protected syncComponentState(remoteComponent: YMap<any>, component: ComponentInstance): void;
73
+ protected runLocalUpdate(fn: () => void, record?: boolean): void;
74
+ protected runRemoteUpdate(tr: Transaction, fn: () => void): void;
75
+ protected createSharedComponentByComponent(component: ComponentInstance): YMap<any>;
76
+ protected createSharedSlotBySlot(slot: Slot): YMap<any>;
77
+ protected createComponentBySharedComponent(yMap: YMap<any>): ComponentInstance;
78
+ protected createSlotBySharedSlot(sharedSlot: YMap<any>): Slot;
79
+ protected cleanSubscriptionsBySlot(slot: Slot): void;
80
+ protected cleanSubscriptionsByComponent(component: ComponentInstance): void;
81
+ }
82
+ export {};