@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.
@@ -1729,6 +1729,7 @@ exports.MessageType = void 0;
1729
1729
  MessageType[MessageType["QueryAwareness"] = 3] = "QueryAwareness";
1730
1730
  MessageType[MessageType["Stateless"] = 5] = "Stateless";
1731
1731
  MessageType[MessageType["CLOSE"] = 7] = "CLOSE";
1732
+ MessageType[MessageType["SyncStatus"] = 8] = "SyncStatus";
1732
1733
  })(exports.MessageType || (exports.MessageType = {}));
1733
1734
  exports.WebSocketStatus = void 0;
1734
1735
  (function (WebSocketStatus) {
@@ -1778,6 +1779,9 @@ class MessageReceiver {
1778
1779
  case exports.MessageType.Stateless:
1779
1780
  provider.receiveStateless(readVarString(message.decoder));
1780
1781
  break;
1782
+ case exports.MessageType.SyncStatus:
1783
+ // nothing for now; forward-compatability
1784
+ break;
1781
1785
  default:
1782
1786
  throw new Error(`Can’t apply message of unknown type: ${type}`);
1783
1787
  }
@@ -2643,6 +2647,39 @@ class TiptapCollabProvider extends HocuspocusProvider {
2643
2647
  configuration.token = 'notoken'; // need to send a token anyway (which will be ignored)
2644
2648
  }
2645
2649
  super(configuration);
2650
+ this.tiptapCollabConfigurationPrefix = '__tiptapcollab__';
2651
+ }
2652
+ createVersion(name) {
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.sendStateless(JSON.stringify({ action: 'version.create', name }));
2655
+ }
2656
+ revertToVersion(targetVersion) {
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.sendStateless(JSON.stringify({ action: 'version.revert', version: targetVersion }));
2659
+ }
2660
+ getVersions() {
2661
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2662
+ return this.configuration.document.getArray(`${this.tiptapCollabConfigurationPrefix}versions`).toArray();
2663
+ }
2664
+ watchVersions(callback) {
2665
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2666
+ return this.configuration.document.getArray('__tiptapcollab__versions').observe(callback);
2667
+ }
2668
+ unwatchVersions(callback) {
2669
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2670
+ return this.configuration.document.getArray('__tiptapcollab__versions').unobserve(callback);
2671
+ }
2672
+ isAutoVersioning() {
2673
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2674
+ return !!this.configuration.document.getMap(`${this.tiptapCollabConfigurationPrefix}config`).get('autoVersioning');
2675
+ }
2676
+ enableAutoVersioning() {
2677
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2678
+ return this.configuration.document.getMap(`${this.tiptapCollabConfigurationPrefix}config`).set('autoVersioning', 1);
2679
+ }
2680
+ disableAutoVersioning() {
2681
+ console.error('This doesnt work yet! If you want to join as a beta tester, send an email to humans@tiptap.dev');
2682
+ return this.configuration.document.getMap(`${this.tiptapCollabConfigurationPrefix}config`).set('autoVersioning', 0);
2646
2683
  }
2647
2684
  }
2648
2685