@textbus/collaborate 4.5.1 → 5.0.0-alpha.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.
@@ -1,4 +1,4 @@
1
- import { History, RootComponentRef, Scheduler } from '@textbus/core';
1
+ import { History, RootComponentRef, Scheduler, Selection } from '@textbus/core';
2
2
  import { Observable } from '@tanbo/stream';
3
3
  import { Item, Transaction } from 'yjs';
4
4
  import { Collaborate } from './collaborate';
@@ -10,6 +10,7 @@ export declare class CollabHistory implements History {
10
10
  private rootComponentRef;
11
11
  private collaborate;
12
12
  private scheduler;
13
+ private selection;
13
14
  private stackSize;
14
15
  private undoManagerConfig;
15
16
  onBack: Observable<void>;
@@ -26,7 +27,7 @@ export declare class CollabHistory implements History {
26
27
  private forwardEvent;
27
28
  private changeEvent;
28
29
  private pushEvent;
29
- constructor(rootComponentRef: RootComponentRef, collaborate: Collaborate, scheduler: Scheduler, stackSize: number, undoManagerConfig: CustomUndoManagerConfig);
30
+ constructor(rootComponentRef: RootComponentRef, collaborate: Collaborate, scheduler: Scheduler, selection: Selection, stackSize: number, undoManagerConfig: CustomUndoManagerConfig);
30
31
  listen(): void;
31
32
  back(): void;
32
33
  forward(): void;
@@ -4,7 +4,6 @@ import { Doc as YDoc } from 'yjs';
4
4
  import { SyncConnector } from './base/_api';
5
5
  export interface CollaborateConfig {
6
6
  createConnector(yDoc: YDoc): SyncConnector;
7
- beforeSync?(yDoc: YDoc): Promise<void> | void;
8
7
  }
9
8
  export declare class CollaborateModule implements Module {
10
9
  config: CollaborateConfig;
@@ -946,7 +946,7 @@ let CollabHistory = class CollabHistory {
946
946
  var _a;
947
947
  return ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.canRedo()) || false;
948
948
  }
949
- constructor(rootComponentRef, collaborate, scheduler, stackSize, undoManagerConfig) {
949
+ constructor(rootComponentRef, collaborate, scheduler, selection, stackSize, undoManagerConfig) {
950
950
  Object.defineProperty(this, "rootComponentRef", {
951
951
  enumerable: true,
952
952
  configurable: true,
@@ -965,6 +965,12 @@ let CollabHistory = class CollabHistory {
965
965
  writable: true,
966
966
  value: scheduler
967
967
  });
968
+ Object.defineProperty(this, "selection", {
969
+ enumerable: true,
970
+ configurable: true,
971
+ writable: true,
972
+ value: selection
973
+ });
968
974
  Object.defineProperty(this, "stackSize", {
969
975
  enumerable: true,
970
976
  configurable: true,
@@ -1151,11 +1157,12 @@ let CollabHistory = class CollabHistory {
1151
1157
  };
1152
1158
  CollabHistory = __decorate([
1153
1159
  Injectable(),
1154
- __param(3, Inject(HISTORY_STACK_SIZE)),
1155
- __param(4, Optional()),
1160
+ __param(4, Inject(HISTORY_STACK_SIZE)),
1161
+ __param(5, Optional()),
1156
1162
  __metadata("design:paramtypes", [RootComponentRef,
1157
1163
  Collaborate,
1158
- Scheduler, Number, CustomUndoManagerConfig])
1164
+ Scheduler,
1165
+ Selection, Number, CustomUndoManagerConfig])
1159
1166
  ], CollabHistory);
1160
1167
 
1161
1168
  /**
@@ -1641,7 +1648,6 @@ class CollaborateModule {
1641
1648
  setup(textbus) {
1642
1649
  const messageBus = textbus.get(MessageBus, null);
1643
1650
  const connector = textbus.get(SyncConnector);
1644
- const collab = textbus.get(Collaborate);
1645
1651
  if (messageBus) {
1646
1652
  const selection = textbus.get(Selection);
1647
1653
  connector.setLocalStateField('message', messageBus.get(textbus));
@@ -1653,10 +1659,7 @@ class CollaborateModule {
1653
1659
  messageBus.consume(states, textbus);
1654
1660
  }));
1655
1661
  }
1656
- return connector.onLoad.toPromise().then(() => {
1657
- var _a, _b;
1658
- return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
1659
- });
1662
+ return connector.onLoad.toPromise();
1660
1663
  }
1661
1664
  onDestroy(textbus) {
1662
1665
  this.subscription.unsubscribe();
@@ -1708,7 +1711,6 @@ class MultipleDocumentCollaborateModule {
1708
1711
  setup(textbus) {
1709
1712
  const messageBus = textbus.get(MessageBus, null);
1710
1713
  const connector = textbus.get(SyncConnector);
1711
- const collab = textbus.get(Collaborate);
1712
1714
  if (messageBus) {
1713
1715
  const selection = textbus.get(Selection);
1714
1716
  connector.setLocalStateField('message', messageBus.get(textbus));
@@ -1720,10 +1722,7 @@ class MultipleDocumentCollaborateModule {
1720
1722
  messageBus.consume(states, textbus);
1721
1723
  }));
1722
1724
  }
1723
- return connector.onLoad.toPromise().then(() => {
1724
- var _a, _b;
1725
- return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
1726
- });
1725
+ return connector.onLoad.toPromise();
1727
1726
  }
1728
1727
  onDestroy(textbus) {
1729
1728
  this.subscription.unsubscribe();
package/bundles/index.js CHANGED
@@ -948,7 +948,7 @@ exports.CollabHistory = class CollabHistory {
948
948
  var _a;
949
949
  return ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.canRedo()) || false;
950
950
  }
951
- constructor(rootComponentRef, collaborate, scheduler, stackSize, undoManagerConfig) {
951
+ constructor(rootComponentRef, collaborate, scheduler, selection, stackSize, undoManagerConfig) {
952
952
  Object.defineProperty(this, "rootComponentRef", {
953
953
  enumerable: true,
954
954
  configurable: true,
@@ -967,6 +967,12 @@ exports.CollabHistory = class CollabHistory {
967
967
  writable: true,
968
968
  value: scheduler
969
969
  });
970
+ Object.defineProperty(this, "selection", {
971
+ enumerable: true,
972
+ configurable: true,
973
+ writable: true,
974
+ value: selection
975
+ });
970
976
  Object.defineProperty(this, "stackSize", {
971
977
  enumerable: true,
972
978
  configurable: true,
@@ -1153,11 +1159,12 @@ exports.CollabHistory = class CollabHistory {
1153
1159
  };
1154
1160
  exports.CollabHistory = __decorate([
1155
1161
  core$1.Injectable(),
1156
- __param(3, core$1.Inject(core.HISTORY_STACK_SIZE)),
1157
- __param(4, core$1.Optional()),
1162
+ __param(4, core$1.Inject(core.HISTORY_STACK_SIZE)),
1163
+ __param(5, core$1.Optional()),
1158
1164
  __metadata("design:paramtypes", [core.RootComponentRef,
1159
1165
  exports.Collaborate,
1160
- core.Scheduler, Number, CustomUndoManagerConfig])
1166
+ core.Scheduler,
1167
+ core.Selection, Number, CustomUndoManagerConfig])
1161
1168
  ], exports.CollabHistory);
1162
1169
 
1163
1170
  /**
@@ -1643,7 +1650,6 @@ class CollaborateModule {
1643
1650
  setup(textbus) {
1644
1651
  const messageBus = textbus.get(MessageBus, null);
1645
1652
  const connector = textbus.get(SyncConnector);
1646
- const collab = textbus.get(exports.Collaborate);
1647
1653
  if (messageBus) {
1648
1654
  const selection = textbus.get(core.Selection);
1649
1655
  connector.setLocalStateField('message', messageBus.get(textbus));
@@ -1655,10 +1661,7 @@ class CollaborateModule {
1655
1661
  messageBus.consume(states, textbus);
1656
1662
  }));
1657
1663
  }
1658
- return connector.onLoad.toPromise().then(() => {
1659
- var _a, _b;
1660
- return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
1661
- });
1664
+ return connector.onLoad.toPromise();
1662
1665
  }
1663
1666
  onDestroy(textbus) {
1664
1667
  this.subscription.unsubscribe();
@@ -1710,7 +1713,6 @@ class MultipleDocumentCollaborateModule {
1710
1713
  setup(textbus) {
1711
1714
  const messageBus = textbus.get(MessageBus, null);
1712
1715
  const connector = textbus.get(SyncConnector);
1713
- const collab = textbus.get(exports.Collaborate);
1714
1716
  if (messageBus) {
1715
1717
  const selection = textbus.get(core.Selection);
1716
1718
  connector.setLocalStateField('message', messageBus.get(textbus));
@@ -1722,10 +1724,7 @@ class MultipleDocumentCollaborateModule {
1722
1724
  messageBus.consume(states, textbus);
1723
1725
  }));
1724
1726
  }
1725
- return connector.onLoad.toPromise().then(() => {
1726
- var _a, _b;
1727
- return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
1728
- });
1727
+ return connector.onLoad.toPromise();
1729
1728
  }
1730
1729
  onDestroy(textbus) {
1731
1730
  this.subscription.unsubscribe();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/collaborate",
3
- "version": "4.5.1",
3
+ "version": "5.0.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,16 +27,16 @@
27
27
  "dependencies": {
28
28
  "@hocuspocus/provider": "^2.15.2",
29
29
  "@tanbo/stream": "^1.2.7",
30
- "@textbus/core": "^4.5.0",
31
- "@viewfly/core": "^1.2.3",
30
+ "@textbus/core": "^5.0.0-alpha.1",
31
+ "@viewfly/core": "^2.0.0-alpha.3",
32
32
  "y-websocket": "^2.1.0",
33
33
  "yjs": "^13.6.23"
34
34
  },
35
35
  "devDependencies": {
36
- "@rollup/plugin-commonjs": "^28.0.2",
37
- "@rollup/plugin-typescript": "^12.1.2",
36
+ "@rollup/plugin-commonjs": "^23.0.2",
37
+ "@rollup/plugin-typescript": "^9.0.2",
38
38
  "rimraf": "^3.0.2",
39
- "rollup": "4.22.4",
39
+ "rollup": "^3.2.5",
40
40
  "tslib": "^2.4.1"
41
41
  },
42
42
  "author": {
@@ -50,5 +50,5 @@
50
50
  "bugs": {
51
51
  "url": "https://github.com/textbus/textbus.git/issues"
52
52
  },
53
- "gitHead": "badc41649d7dbf25bc832bcbf37e02936ee5a847"
53
+ "gitHead": "97fad583844a41a761a107ff8500039c178ec321"
54
54
  }