@textbus/collaborate 4.5.0 → 4.5.2

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.
@@ -356,11 +356,8 @@ let Collaborate = class Collaborate {
356
356
  if (formats.length) {
357
357
  localSlot.retain(action.retain, formats);
358
358
  }
359
- localSlot.retain(localSlot.index + action.retain);
360
- }
361
- else {
362
- localSlot.retain(action.retain);
363
359
  }
360
+ localSlot.retain(localSlot.index + action.retain);
364
361
  }
365
362
  else if (action.insert) {
366
363
  const index = localSlot.index;
@@ -445,6 +442,7 @@ let Collaborate = class Collaborate {
445
442
  else if (action.type === 'delete') {
446
443
  const delta = sharedSlot.toDelta();
447
444
  if (sharedSlot.length) {
445
+ console.log([offset, action.count]);
448
446
  sharedSlot.delete(offset, action.count);
449
447
  }
450
448
  if (sharedSlot.length === 0) {
@@ -1708,6 +1706,7 @@ class MultipleDocumentCollaborateModule {
1708
1706
  setup(textbus) {
1709
1707
  const messageBus = textbus.get(MessageBus, null);
1710
1708
  const connector = textbus.get(SyncConnector);
1709
+ const collab = textbus.get(Collaborate);
1711
1710
  if (messageBus) {
1712
1711
  const selection = textbus.get(Selection);
1713
1712
  connector.setLocalStateField('message', messageBus.get(textbus));
@@ -1719,7 +1718,10 @@ class MultipleDocumentCollaborateModule {
1719
1718
  messageBus.consume(states, textbus);
1720
1719
  }));
1721
1720
  }
1722
- return connector.onLoad.toPromise();
1721
+ return connector.onLoad.toPromise().then(() => {
1722
+ var _a, _b;
1723
+ return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
1724
+ });
1723
1725
  }
1724
1726
  onDestroy(textbus) {
1725
1727
  this.subscription.unsubscribe();
package/bundles/index.js CHANGED
@@ -358,11 +358,8 @@ exports.Collaborate = class Collaborate {
358
358
  if (formats.length) {
359
359
  localSlot.retain(action.retain, formats);
360
360
  }
361
- localSlot.retain(localSlot.index + action.retain);
362
- }
363
- else {
364
- localSlot.retain(action.retain);
365
361
  }
362
+ localSlot.retain(localSlot.index + action.retain);
366
363
  }
367
364
  else if (action.insert) {
368
365
  const index = localSlot.index;
@@ -447,6 +444,7 @@ exports.Collaborate = class Collaborate {
447
444
  else if (action.type === 'delete') {
448
445
  const delta = sharedSlot.toDelta();
449
446
  if (sharedSlot.length) {
447
+ console.log([offset, action.count]);
450
448
  sharedSlot.delete(offset, action.count);
451
449
  }
452
450
  if (sharedSlot.length === 0) {
@@ -1710,6 +1708,7 @@ class MultipleDocumentCollaborateModule {
1710
1708
  setup(textbus) {
1711
1709
  const messageBus = textbus.get(MessageBus, null);
1712
1710
  const connector = textbus.get(SyncConnector);
1711
+ const collab = textbus.get(exports.Collaborate);
1713
1712
  if (messageBus) {
1714
1713
  const selection = textbus.get(core.Selection);
1715
1714
  connector.setLocalStateField('message', messageBus.get(textbus));
@@ -1721,7 +1720,10 @@ class MultipleDocumentCollaborateModule {
1721
1720
  messageBus.consume(states, textbus);
1722
1721
  }));
1723
1722
  }
1724
- return connector.onLoad.toPromise();
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
1727
  }
1726
1728
  onDestroy(textbus) {
1727
1729
  this.subscription.unsubscribe();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/collaborate",
3
- "version": "4.5.0",
3
+ "version": "4.5.2",
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",
@@ -50,5 +50,5 @@
50
50
  "bugs": {
51
51
  "url": "https://github.com/textbus/textbus.git/issues"
52
52
  },
53
- "gitHead": "327e764487545a35d97eae525b61307642b8f386"
53
+ "gitHead": "0c14e545ff70b079ae6b44c6c2e1e09bc11cb190"
54
54
  }