@textbus/collaborate 4.0.3 → 4.1.0-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,35 @@
1
+ import { Observable } from '@tanbo/stream';
2
+ import { History, RootComponentRef } from '@textbus/core';
3
+ import { Collaborate } from './collaborate';
4
+ import { CustomUndoManagerConfig } from './collab-history';
5
+ export declare class MultipleDocCollabHistory implements History {
6
+ private collaborate;
7
+ private rootComponentRef;
8
+ private stackSize;
9
+ private undoManagerConfig;
10
+ onChange: Observable<void>;
11
+ onBack: Observable<void>;
12
+ onForward: Observable<void>;
13
+ onPush: Observable<void>;
14
+ get canBack(): boolean;
15
+ get canForward(): boolean;
16
+ isListen: boolean;
17
+ private changeEvent;
18
+ private backEvent;
19
+ private forwardEvent;
20
+ private pushEvent;
21
+ private actionStack;
22
+ private index;
23
+ private stackItem;
24
+ private timer;
25
+ private subscription;
26
+ private subDocs;
27
+ private listenerCaches;
28
+ constructor(collaborate: Collaborate, rootComponentRef: RootComponentRef, stackSize: number, undoManagerConfig: CustomUndoManagerConfig);
29
+ listen(): void;
30
+ forward(): void;
31
+ back(): void;
32
+ clear(): void;
33
+ destroy(): void;
34
+ private listenItem;
35
+ }
@@ -0,0 +1,14 @@
1
+ import { Module, Textbus } from '@textbus/core';
2
+ import { Provider } from '@viewfly/core';
3
+ import { CollaborateConfig } from './collaborate-module';
4
+ import { SubModelLoader } from './sub-model-loader';
5
+ export interface MultipleDocCollaborateConfig extends CollaborateConfig {
6
+ subModelLoader: SubModelLoader;
7
+ }
8
+ export declare class MultipleDocumentCollaborateModule implements Module {
9
+ config: MultipleDocCollaborateConfig;
10
+ providers: Provider[];
11
+ constructor(config: MultipleDocCollaborateConfig);
12
+ setup(textbus: Textbus): Promise<(() => void) | void> | (() => void) | void;
13
+ onDestroy(textbus: Textbus): void;
14
+ }
@@ -1,5 +1,9 @@
1
1
  export * from './connectors/_api';
2
+ export * from './collab-history';
2
3
  export * from './collaborate';
3
4
  export * from './collaborate-module';
5
+ export * from './multiple-doc-collab-history';
6
+ export * from './multiple-document-collaborate-module';
7
+ export * from './sub-model-loader';
4
8
  export * from './sync-connector';
5
9
  export * from './user-activity';
@@ -0,0 +1,45 @@
1
+ import { Doc, Doc as YDoc } from 'yjs';
2
+ import { AsyncComponent, AsyncSlot } from '@textbus/core';
3
+ /**
4
+ * 子文档加载器
5
+ */
6
+ export declare abstract class SubModelLoader {
7
+ /**
8
+ * 通过插槽获取已加载的文档
9
+ * @param slot
10
+ */
11
+ abstract getLoadedModelBySlot(slot: AsyncSlot): YDoc | null;
12
+ /**
13
+ * 通过组件获取已加载的文档
14
+ * @param component
15
+ */
16
+ abstract getLoadedModelByComponent(component: AsyncComponent): YDoc | null;
17
+ /**
18
+ * 当本地新增异步子插槽时调用
19
+ * @param slot
20
+ */
21
+ abstract createSubModelBySlot(slot: AsyncSlot): Promise<YDoc>;
22
+ /**
23
+ * 当本地新增异步子组件时调用
24
+ * @param component
25
+ */
26
+ abstract createSubModelByComponent(component: AsyncComponent): Promise<YDoc>;
27
+ /**
28
+ * 当远程异步子插槽同步到本地时调用
29
+ * @param slot
30
+ */
31
+ abstract loadSubModelBySlot(slot: AsyncSlot): Promise<YDoc>;
32
+ /**
33
+ * 当远程异步子组件同步到本地时调用
34
+ * @param component
35
+ */
36
+ abstract loadSubModelByComponent(component: AsyncComponent): Promise<YDoc>;
37
+ }
38
+ export declare class NonSubModelLoader extends SubModelLoader {
39
+ createSubModelBySlot(): Promise<Doc>;
40
+ createSubModelByComponent(): Promise<Doc>;
41
+ loadSubModelByComponent(): Promise<Doc>;
42
+ loadSubModelBySlot(): Promise<Doc>;
43
+ getLoadedModelBySlot(): Doc;
44
+ getLoadedModelByComponent(): Doc;
45
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/collaborate",
3
- "version": "4.0.3",
3
+ "version": "4.1.0-alpha.0",
4
4
  "description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",
@@ -27,8 +27,8 @@
27
27
  "dependencies": {
28
28
  "@hocuspocus/provider": "^2.13.6",
29
29
  "@tanbo/stream": "^1.2.5",
30
- "@textbus/core": "^4.0.3",
31
- "@viewfly/core": "^1.0.2",
30
+ "@textbus/core": "^4.1.0-alpha.0",
31
+ "@viewfly/core": "^1.0.4",
32
32
  "y-websocket": "^1.4.3",
33
33
  "yjs": "^13.6.14"
34
34
  },