@hocuspocus/provider 2.2.2 → 2.2.3

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.
@@ -1705,6 +1705,7 @@ var MessageType;
1705
1705
  MessageType[MessageType["QueryAwareness"] = 3] = "QueryAwareness";
1706
1706
  MessageType[MessageType["Stateless"] = 5] = "Stateless";
1707
1707
  MessageType[MessageType["CLOSE"] = 7] = "CLOSE";
1708
+ MessageType[MessageType["SyncStatus"] = 8] = "SyncStatus";
1708
1709
  })(MessageType || (MessageType = {}));
1709
1710
  var WebSocketStatus;
1710
1711
  (function (WebSocketStatus) {
@@ -1754,6 +1755,9 @@ class MessageReceiver {
1754
1755
  case MessageType.Stateless:
1755
1756
  provider.receiveStateless(readVarString(message.decoder));
1756
1757
  break;
1758
+ case MessageType.SyncStatus:
1759
+ // nothing for now; forward-compatability
1760
+ break;
1757
1761
  default:
1758
1762
  throw new Error(`Can’t apply message of unknown type: ${type}`);
1759
1763
  }
@@ -2619,6 +2623,39 @@ class TiptapCollabProvider extends HocuspocusProvider {
2619
2623
  configuration.token = 'notoken'; // need to send a token anyway (which will be ignored)
2620
2624
  }
2621
2625
  super(configuration);
2626
+ this.tiptapCollabConfigurationPrefix = '__tiptapcollab__';
2627
+ }
2628
+ createVersion(name) {
2629
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2630
+ return this.sendStateless(JSON.stringify({ action: 'version.create', name }));
2631
+ }
2632
+ revertToVersion(targetVersion) {
2633
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2634
+ return this.sendStateless(JSON.stringify({ action: 'version.revert', version: targetVersion }));
2635
+ }
2636
+ getVersions() {
2637
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2638
+ return this.configuration.document.getArray(`${this.tiptapCollabConfigurationPrefix}versions`).toArray();
2639
+ }
2640
+ watchVersions(callback) {
2641
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2642
+ return this.configuration.document.getArray('__tiptapcollab__versions').observe(callback);
2643
+ }
2644
+ unwatchVersions(callback) {
2645
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2646
+ return this.configuration.document.getArray('__tiptapcollab__versions').unobserve(callback);
2647
+ }
2648
+ isAutoVersioning() {
2649
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2650
+ return !!this.configuration.document.getMap(`${this.tiptapCollabConfigurationPrefix}config`).get('autoVersioning');
2651
+ }
2652
+ enableAutoVersioning() {
2653
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2654
+ return this.configuration.document.getMap(`${this.tiptapCollabConfigurationPrefix}config`).set('autoVersioning', 1);
2655
+ }
2656
+ disableAutoVersioning() {
2657
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2658
+ return this.configuration.document.getMap(`${this.tiptapCollabConfigurationPrefix}config`).set('autoVersioning', 0);
2622
2659
  }
2623
2660
  }
2624
2661