@remirror/extension-yjs 1.0.19 → 1.0.20

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,5 +1,5 @@
1
1
  import type { Doc } from 'yjs';
2
- import { AcceptUndefined, EditorState, KeyBindingProps, NonChainableCommandFunction, OnSetOptionsProps, PlainExtension, ProsemirrorPlugin, Selection, Shape } from '@remirror/core';
2
+ import { AcceptUndefined, Dispose, EditorState, KeyBindingProps, NonChainableCommandFunction, OnSetOptionsProps, PlainExtension, ProsemirrorPlugin, Selection, Shape } from '@remirror/core';
3
3
  export interface ColorDef {
4
4
  light: string;
5
5
  dark: string;
@@ -73,7 +73,7 @@ export declare class YjsExtension extends PlainExtension<YjsOptions> {
73
73
  * The provider that is being used for the editor.
74
74
  */
75
75
  get provider(): YjsRealtimeProvider;
76
- onView(): void;
76
+ onView(): Dispose | void;
77
77
  /**
78
78
  * Create the yjs plugins.
79
79
  */
@@ -77,7 +77,8 @@ var YjsExtension = (_dec = core.extension({
77
77
  transformPosition: this.absolutePositionToRelativePosition.bind(this),
78
78
  transformPositionBeforeRender: this.relativePositionToAbsolutePosition.bind(this)
79
79
  });
80
- this.provider.doc.on('update', (_update, _origin, _doc, yjsTr) => {
80
+
81
+ var handler = (_update, _origin, _doc, yjsTr) => {
81
82
  var _this$store$commands$, _this$store$commands;
82
83
 
83
84
  // Ignore own changes
@@ -86,7 +87,12 @@ var YjsExtension = (_dec = core.extension({
86
87
  }
87
88
 
88
89
  (_this$store$commands$ = (_this$store$commands = this.store.commands).redrawAnnotations) === null || _this$store$commands$ === void 0 ? void 0 : _this$store$commands$.call(_this$store$commands);
89
- });
90
+ };
91
+
92
+ this.provider.doc.on('update', handler);
93
+ return () => {
94
+ this.provider.doc.off('update', handler);
95
+ };
90
96
  } catch (_unused) {// AnnotationExtension isn't present in editor
91
97
  }
92
98
  }
@@ -73,7 +73,8 @@ var YjsExtension = (_dec = extension({
73
73
  transformPosition: this.absolutePositionToRelativePosition.bind(this),
74
74
  transformPositionBeforeRender: this.relativePositionToAbsolutePosition.bind(this)
75
75
  });
76
- this.provider.doc.on('update', (_update, _origin, _doc, yjsTr) => {
76
+
77
+ var handler = (_update, _origin, _doc, yjsTr) => {
77
78
  var _this$store$commands$, _this$store$commands;
78
79
 
79
80
  // Ignore own changes
@@ -82,7 +83,12 @@ var YjsExtension = (_dec = extension({
82
83
  }
83
84
 
84
85
  (_this$store$commands$ = (_this$store$commands = this.store.commands).redrawAnnotations) === null || _this$store$commands$ === void 0 ? void 0 : _this$store$commands$.call(_this$store$commands);
85
- });
86
+ };
87
+
88
+ this.provider.doc.on('update', handler);
89
+ return () => {
90
+ this.provider.doc.off('update', handler);
91
+ };
86
92
  } catch (_unused) {// AnnotationExtension isn't present in editor
87
93
  }
88
94
  }
@@ -77,7 +77,8 @@ var YjsExtension = (_dec = core.extension({
77
77
  transformPosition: this.absolutePositionToRelativePosition.bind(this),
78
78
  transformPositionBeforeRender: this.relativePositionToAbsolutePosition.bind(this)
79
79
  });
80
- this.provider.doc.on('update', (_update, _origin, _doc, yjsTr) => {
80
+
81
+ var handler = (_update, _origin, _doc, yjsTr) => {
81
82
  var _this$store$commands$, _this$store$commands;
82
83
 
83
84
  // Ignore own changes
@@ -86,7 +87,12 @@ var YjsExtension = (_dec = core.extension({
86
87
  }
87
88
 
88
89
  (_this$store$commands$ = (_this$store$commands = this.store.commands).redrawAnnotations) === null || _this$store$commands$ === void 0 ? void 0 : _this$store$commands$.call(_this$store$commands);
89
- });
90
+ };
91
+
92
+ this.provider.doc.on('update', handler);
93
+ return () => {
94
+ this.provider.doc.off('update', handler);
95
+ };
90
96
  } catch (_unused) {// AnnotationExtension isn't present in editor
91
97
  }
92
98
  }
@@ -74,7 +74,8 @@ var YjsExtension = (_dec = core.extension({
74
74
  transformPosition: this.absolutePositionToRelativePosition.bind(this),
75
75
  transformPositionBeforeRender: this.relativePositionToAbsolutePosition.bind(this)
76
76
  });
77
- this.provider.doc.on('update', (_update, _origin, _doc, yjsTr) => {
77
+
78
+ var handler = (_update, _origin, _doc, yjsTr) => {
78
79
  var _this$store$commands$, _this$store$commands;
79
80
 
80
81
  // Ignore own changes
@@ -83,7 +84,12 @@ var YjsExtension = (_dec = core.extension({
83
84
  }
84
85
 
85
86
  (_this$store$commands$ = (_this$store$commands = this.store.commands).redrawAnnotations) === null || _this$store$commands$ === void 0 ? void 0 : _this$store$commands$.call(_this$store$commands);
86
- });
87
+ };
88
+
89
+ this.provider.doc.on('update', handler);
90
+ return () => {
91
+ this.provider.doc.off('update', handler);
92
+ };
87
93
  } catch (_unused) {// AnnotationExtension isn't present in editor
88
94
  }
89
95
  }
@@ -73,7 +73,8 @@ var YjsExtension = (_dec = extension({
73
73
  transformPosition: this.absolutePositionToRelativePosition.bind(this),
74
74
  transformPositionBeforeRender: this.relativePositionToAbsolutePosition.bind(this)
75
75
  });
76
- this.provider.doc.on('update', (_update, _origin, _doc, yjsTr) => {
76
+
77
+ var handler = (_update, _origin, _doc, yjsTr) => {
77
78
  var _this$store$commands$, _this$store$commands;
78
79
 
79
80
  // Ignore own changes
@@ -82,7 +83,12 @@ var YjsExtension = (_dec = extension({
82
83
  }
83
84
 
84
85
  (_this$store$commands$ = (_this$store$commands = this.store.commands).redrawAnnotations) === null || _this$store$commands$ === void 0 ? void 0 : _this$store$commands$.call(_this$store$commands);
85
- });
86
+ };
87
+
88
+ this.provider.doc.on('update', handler);
89
+ return () => {
90
+ this.provider.doc.off('update', handler);
91
+ };
86
92
  } catch (_unused) {// AnnotationExtension isn't present in editor
87
93
  }
88
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remirror/extension-yjs",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "Realtime collaboration with yjs",
5
5
  "keywords": [
6
6
  "remirror",
@@ -45,13 +45,13 @@
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.13.10",
47
47
  "@remirror/core": "^1.3.3",
48
- "@remirror/extension-annotation": "^1.1.10",
48
+ "@remirror/extension-annotation": "^1.1.11",
49
49
  "@remirror/messages": "^1.0.6",
50
50
  "y-prosemirror": "^1.0.14",
51
51
  "y-protocols": "^1.0.5"
52
52
  },
53
53
  "devDependencies": {
54
- "@remirror/pm": "^1.0.10",
54
+ "@remirror/pm": "^1.0.11",
55
55
  "y-webrtc": "^10.2.2",
56
56
  "yjs": "^13.5.23"
57
57
  },