@textbus/collaborate 2.5.14 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- Textbus
2
- =====================
3
-
4
- Textbus 是一套用于构建富交互的富文本编辑框架。和大多数富文本编辑器不同的是,Textbus 以组件为核心,格式为辅助,并大幅简化了富文本编辑器开发中常见 API,且提供了更高的抽象层,使 Textbus 不仅易于上手,同时还能驱动复杂的富文本应用。
5
-
6
- 本项目为 Textbus 协作编辑实现,提供了多人在线协作编辑能力的支持。
7
-
8
- ### 文档
9
-
10
- 更多文档请参考:[中文文档](https://textbus.io)
1
+ Textbus
2
+ =====================
3
+
4
+ Textbus 是一套用于构建富交互的富文本编辑框架。和大多数富文本编辑器不同的是,Textbus 以组件为核心,格式为辅助,并大幅简化了富文本编辑器开发中常见 API,且提供了更高的抽象层,使 Textbus 不仅易于上手,同时还能驱动复杂的富文本应用。
5
+
6
+ 本项目为 Textbus 协作编辑实现,提供了多人在线协作编辑能力的支持。
7
+
8
+ ### 文档
9
+
10
+ 更多文档请参考:[中文文档](https://textbus.io)
@@ -1,44 +1,44 @@
1
- import { Injector } from '@tanbo/di';
2
- import { SelectionBridge } from '@textbus/browser';
3
- import { Selection, SelectionPaths, AbstractSelection, Scheduler, Rect } from '@textbus/core';
4
- export interface RemoteSelection {
5
- id: string;
6
- color: string;
7
- username: string;
8
- paths: SelectionPaths;
9
- }
10
- export interface SelectionRect extends Rect {
11
- color: string;
12
- username: string;
13
- id: string;
14
- }
15
- export interface RemoteSelectionCursor {
16
- cursor: HTMLElement;
17
- anchor: HTMLElement;
18
- userTip: HTMLElement;
19
- }
20
- export declare abstract class CollaborateSelectionAwarenessDelegate {
21
- abstract getRects(abstractSelection: AbstractSelection, nativeRange: Range): false | Rect[];
22
- }
23
- export declare class CollaborateCursor {
24
- private injector;
25
- private nativeSelection;
26
- private scheduler;
27
- private selection;
28
- private awarenessDelegate?;
29
- private host;
30
- private canvasContainer;
31
- private canvas;
32
- private context;
33
- private tooltips;
34
- private onRectsChange;
35
- private subscription;
36
- private currentSelection;
37
- private container;
38
- constructor(injector: Injector, nativeSelection: SelectionBridge, scheduler: Scheduler, selection: Selection, awarenessDelegate?: CollaborateSelectionAwarenessDelegate | undefined);
39
- refresh(): void;
40
- destroy(): void;
41
- draw(paths: RemoteSelection[]): void;
42
- protected drawUserCursor(rects: SelectionRect[]): void;
43
- private getUserCursor;
44
- }
1
+ import { Injector } from '@tanbo/di';
2
+ import { SelectionBridge } from '@textbus/browser';
3
+ import { Selection, SelectionPaths, AbstractSelection, Scheduler, Rect } from '@textbus/core';
4
+ export interface RemoteSelection {
5
+ id: string;
6
+ color: string;
7
+ username: string;
8
+ paths: SelectionPaths;
9
+ }
10
+ export interface SelectionRect extends Rect {
11
+ color: string;
12
+ username: string;
13
+ id: string;
14
+ }
15
+ export interface RemoteSelectionCursor {
16
+ cursor: HTMLElement;
17
+ anchor: HTMLElement;
18
+ userTip: HTMLElement;
19
+ }
20
+ export declare abstract class CollaborateSelectionAwarenessDelegate {
21
+ abstract getRects(abstractSelection: AbstractSelection, nativeRange: Range): false | Rect[];
22
+ }
23
+ export declare class CollaborateCursor {
24
+ private injector;
25
+ private nativeSelection;
26
+ private scheduler;
27
+ private selection;
28
+ private awarenessDelegate?;
29
+ private host;
30
+ private canvasContainer;
31
+ private canvas;
32
+ private context;
33
+ private tooltips;
34
+ private onRectsChange;
35
+ private subscription;
36
+ private currentSelection;
37
+ private container;
38
+ constructor(injector: Injector, nativeSelection: SelectionBridge, scheduler: Scheduler, selection: Selection, awarenessDelegate?: CollaborateSelectionAwarenessDelegate | undefined);
39
+ refresh(): void;
40
+ destroy(): void;
41
+ draw(paths: RemoteSelection[]): void;
42
+ protected drawUserCursor(rects: SelectionRect[]): void;
43
+ private getUserCursor;
44
+ }
@@ -1,82 +1,82 @@
1
- import { Observable, Subject, Subscription } from '@tanbo/stream';
2
- import { AbstractSelection, ComponentInstance, Controller, History, Registry, RootComponentRef, Scheduler, Selection, SelectionPaths, Slot, Starter, Translator } 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 translator: Translator;
29
- protected registry: Registry;
30
- protected selection: Selection;
31
- protected starter: Starter;
32
- onLocalChangesApplied: Observable<void>;
33
- onSelectionChange: Observable<SelectionPaths>;
34
- yDoc: YDoc;
35
- onBack: Observable<void>;
36
- onForward: Observable<void>;
37
- onChange: Observable<void>;
38
- onPush: Observable<void>;
39
- get canBack(): boolean;
40
- get canForward(): boolean;
41
- protected backEvent: Subject<void>;
42
- protected forwardEvent: Subject<void>;
43
- protected changeEvent: Subject<void>;
44
- protected pushEvent: Subject<void>;
45
- protected manager: UndoManager | null;
46
- protected subscriptions: Subscription[];
47
- protected updateFromRemote: boolean;
48
- protected contentSyncCaches: WeakMap<Slot<any>, () => void>;
49
- protected slotStateSyncCaches: WeakMap<Slot<any>, () => void>;
50
- protected slotsSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
51
- protected componentStateSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
52
- protected localChangesAppliedEvent: Subject<void>;
53
- protected selectionChangeEvent: Subject<SelectionPaths>;
54
- protected contentMap: ContentMap;
55
- protected updateRemoteActions: Array<UpdateItem>;
56
- protected noRecord: {};
57
- protected historyItems: Array<CursorPosition | null>;
58
- protected index: number;
59
- constructor(stackSize: number, rootComponentRef: RootComponentRef, collaborateCursor: CollaborateCursor, controller: Controller, scheduler: Scheduler, translator: Translator, registry: Registry, selection: Selection, starter: Starter);
60
- listen(): void;
61
- updateRemoteSelection(paths: RemoteSelection[]): 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 syncContent(content: YText, slot: Slot): void;
70
- protected syncSlot(remoteSlot: YMap<any>, slot: Slot): void;
71
- protected syncSlots(remoteSlots: YArray<any>, component: ComponentInstance): void;
72
- protected syncComponent(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>, canInsertInlineComponent: boolean): 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, History, Registry, RootComponentRef, Scheduler, Selection, SelectionPaths, Slot, Starter, Translator } 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 translator: Translator;
29
+ protected registry: Registry;
30
+ protected selection: Selection;
31
+ protected starter: Starter;
32
+ onLocalChangesApplied: Observable<void>;
33
+ onSelectionChange: Observable<SelectionPaths>;
34
+ yDoc: YDoc;
35
+ onBack: Observable<void>;
36
+ onForward: Observable<void>;
37
+ onChange: Observable<void>;
38
+ onPush: Observable<void>;
39
+ get canBack(): boolean;
40
+ get canForward(): boolean;
41
+ protected backEvent: Subject<void>;
42
+ protected forwardEvent: Subject<void>;
43
+ protected changeEvent: Subject<void>;
44
+ protected pushEvent: Subject<void>;
45
+ protected manager: UndoManager | null;
46
+ protected subscriptions: Subscription[];
47
+ protected updateFromRemote: boolean;
48
+ protected contentSyncCaches: WeakMap<Slot<any>, () => void>;
49
+ protected slotStateSyncCaches: WeakMap<Slot<any>, () => void>;
50
+ protected slotsSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
51
+ protected componentStateSyncCaches: WeakMap<ComponentInstance<import("@textbus/core").ComponentExtends, any, unknown>, () => void>;
52
+ protected localChangesAppliedEvent: Subject<void>;
53
+ protected selectionChangeEvent: Subject<SelectionPaths>;
54
+ protected contentMap: ContentMap;
55
+ protected updateRemoteActions: Array<UpdateItem>;
56
+ protected noRecord: {};
57
+ protected historyItems: Array<CursorPosition | null>;
58
+ protected index: number;
59
+ constructor(stackSize: number, rootComponentRef: RootComponentRef, collaborateCursor: CollaborateCursor, controller: Controller, scheduler: Scheduler, translator: Translator, registry: Registry, selection: Selection, starter: Starter);
60
+ listen(): void;
61
+ updateRemoteSelection(paths: RemoteSelection[]): 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 syncContent(content: YText, slot: Slot): void;
70
+ protected syncSlot(remoteSlot: YMap<any>, slot: Slot): void;
71
+ protected syncSlots(remoteSlots: YArray<any>, component: ComponentInstance): void;
72
+ protected syncComponent(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>, canInsertInlineComponent: boolean): ComponentInstance;
78
+ protected createSlotBySharedSlot(sharedSlot: YMap<any>): Slot;
79
+ protected cleanSubscriptionsBySlot(slot: Slot): void;
80
+ protected cleanSubscriptionsByComponent(component: ComponentInstance): void;
81
+ }
82
+ export {};