@textbus/collaborate 4.0.4 → 4.1.0-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,37 @@
1
+ import { Observable } from '@tanbo/stream';
2
+ import { History, RootComponentRef, Scheduler } 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 scheduler;
8
+ private rootComponentRef;
9
+ private stackSize;
10
+ private undoManagerConfig;
11
+ onChange: Observable<void>;
12
+ onBack: Observable<void>;
13
+ onForward: Observable<void>;
14
+ onPush: Observable<void>;
15
+ get canBack(): boolean;
16
+ get canForward(): boolean;
17
+ isListen: boolean;
18
+ private changeEvent;
19
+ private backEvent;
20
+ private forwardEvent;
21
+ private pushEvent;
22
+ private actionStack;
23
+ private index;
24
+ private stackItem;
25
+ private timer;
26
+ private beforePosition;
27
+ private subscription;
28
+ private subDocs;
29
+ private listenerCaches;
30
+ constructor(collaborate: Collaborate, scheduler: Scheduler, rootComponentRef: RootComponentRef, stackSize: number, undoManagerConfig: CustomUndoManagerConfig);
31
+ listen(): void;
32
+ forward(): void;
33
+ back(): void;
34
+ clear(): void;
35
+ destroy(): void;
36
+ private listenItem;
37
+ }
@@ -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.4",
3
+ "version": "4.1.0-alpha.1",
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,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@hocuspocus/provider": "^2.13.6",
29
29
  "@tanbo/stream": "^1.2.5",
30
- "@textbus/core": "^4.0.4",
30
+ "@textbus/core": "^4.1.0-alpha.0",
31
31
  "@viewfly/core": "^1.0.4",
32
32
  "y-websocket": "^1.4.3",
33
33
  "yjs": "^13.6.14"
@@ -50,5 +50,5 @@
50
50
  "bugs": {
51
51
  "url": "https://github.com/textbus/textbus.git/issues"
52
52
  },
53
- "gitHead": "cf4fd289b73bc777124a32fe42bb58eba05a34f1"
53
+ "gitHead": "04567b43046abd508826c795a27531b37a7753e3"
54
54
  }