@remirror/extension-yjs 1.0.28 → 1.0.31

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,6 @@
1
1
  import type { Doc } from 'yjs';
2
2
  import { AcceptUndefined, Dispose, EditorState, KeyBindingProps, NonChainableCommandFunction, OnSetOptionsProps, PlainExtension, ProsemirrorPlugin, Selection, Shape, Static } from '@remirror/core';
3
+ import { DecorationAttrs } from '@remirror/pm/view';
3
4
  export interface ColorDef {
4
5
  light: string;
5
6
  dark: string;
@@ -41,6 +42,10 @@ export interface YjsOptions<Provider extends YjsRealtimeProvider = YjsRealtimePr
41
42
  * See https://github.com/yjs/y-prosemirror#remote-cursors
42
43
  */
43
44
  cursorBuilder?: (user: Shape) => HTMLElement;
45
+ /**
46
+ * Generator for the selection attributes
47
+ */
48
+ selectionBuilder?: (user: Shape) => DecorationAttrs;
44
49
  /**
45
50
  * By default all editor bindings use the awareness 'cursor' field to
46
51
  * propagate cursor information.
@@ -115,6 +115,7 @@ var YjsExtension = (_dec = core.extension({
115
115
  destroyProvider: defaultDestroyProvider,
116
116
  syncPluginOptions: undefined,
117
117
  cursorBuilder: yProsemirror.defaultCursorBuilder,
118
+ selectionBuilder: yProsemirror.defaultSelectionBuilder,
118
119
  cursorStateField: 'cursor',
119
120
  getSelection: state => state.selection,
120
121
  disableUndo: false,
@@ -217,13 +218,14 @@ var YjsExtension = (_dec = core.extension({
217
218
  cursorStateField = _this$options.cursorStateField,
218
219
  disableUndo = _this$options.disableUndo,
219
220
  protectedNodes = _this$options.protectedNodes,
220
- trackedOrigins = _this$options.trackedOrigins;
221
+ trackedOrigins = _this$options.trackedOrigins,
222
+ selectionBuilder = _this$options.selectionBuilder;
221
223
  var yDoc = this.provider.doc;
222
224
  var type = yDoc.getXmlFragment('prosemirror');
223
225
  var plugins = [yProsemirror.ySyncPlugin(type, syncPluginOptions), yProsemirror.yCursorPlugin(this.provider.awareness, {
224
226
  cursorBuilder,
225
- cursorStateField,
226
- getSelection
227
+ getSelection,
228
+ selectionBuilder
227
229
  }, cursorStateField)];
228
230
 
229
231
  if (!disableUndo) {
@@ -1,7 +1,7 @@
1
1
  import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
2
  import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
4
- import { defaultCursorBuilder, ySyncPluginKey, ySyncPlugin, yCursorPlugin, defaultDeleteFilter, yUndoPlugin, yUndoPluginKey, undo, redo, absolutePositionToRelativePosition, relativePositionToAbsolutePosition } from 'y-prosemirror';
4
+ import { defaultCursorBuilder, defaultSelectionBuilder, ySyncPluginKey, ySyncPlugin, yCursorPlugin, defaultDeleteFilter, yUndoPlugin, yUndoPluginKey, undo, redo, absolutePositionToRelativePosition, relativePositionToAbsolutePosition } from 'y-prosemirror';
5
5
  import { UndoManager, transact } from 'yjs';
6
6
  import { extension, invariant, ErrorConstant, ExtensionPriority, command, keyBinding, NamedShortcut, PlainExtension, isFunction, isEmptyObject, nonChainable, convertCommand } from '@remirror/core';
7
7
  import { AnnotationExtension } from '@remirror/extension-annotation';
@@ -111,6 +111,7 @@ var YjsExtension = (_dec = extension({
111
111
  destroyProvider: defaultDestroyProvider,
112
112
  syncPluginOptions: undefined,
113
113
  cursorBuilder: defaultCursorBuilder,
114
+ selectionBuilder: defaultSelectionBuilder,
114
115
  cursorStateField: 'cursor',
115
116
  getSelection: state => state.selection,
116
117
  disableUndo: false,
@@ -213,13 +214,14 @@ var YjsExtension = (_dec = extension({
213
214
  cursorStateField = _this$options.cursorStateField,
214
215
  disableUndo = _this$options.disableUndo,
215
216
  protectedNodes = _this$options.protectedNodes,
216
- trackedOrigins = _this$options.trackedOrigins;
217
+ trackedOrigins = _this$options.trackedOrigins,
218
+ selectionBuilder = _this$options.selectionBuilder;
217
219
  var yDoc = this.provider.doc;
218
220
  var type = yDoc.getXmlFragment('prosemirror');
219
221
  var plugins = [ySyncPlugin(type, syncPluginOptions), yCursorPlugin(this.provider.awareness, {
220
222
  cursorBuilder,
221
- cursorStateField,
222
- getSelection
223
+ getSelection,
224
+ selectionBuilder
223
225
  }, cursorStateField)];
224
226
 
225
227
  if (!disableUndo) {
@@ -115,6 +115,7 @@ var YjsExtension = (_dec = core.extension({
115
115
  destroyProvider: defaultDestroyProvider,
116
116
  syncPluginOptions: undefined,
117
117
  cursorBuilder: yProsemirror.defaultCursorBuilder,
118
+ selectionBuilder: yProsemirror.defaultSelectionBuilder,
118
119
  cursorStateField: 'cursor',
119
120
  getSelection: state => state.selection,
120
121
  disableUndo: false,
@@ -217,13 +218,14 @@ var YjsExtension = (_dec = core.extension({
217
218
  cursorStateField = _this$options.cursorStateField,
218
219
  disableUndo = _this$options.disableUndo,
219
220
  protectedNodes = _this$options.protectedNodes,
220
- trackedOrigins = _this$options.trackedOrigins;
221
+ trackedOrigins = _this$options.trackedOrigins,
222
+ selectionBuilder = _this$options.selectionBuilder;
221
223
  var yDoc = this.provider.doc;
222
224
  var type = yDoc.getXmlFragment('prosemirror');
223
225
  var plugins = [yProsemirror.ySyncPlugin(type, syncPluginOptions), yProsemirror.yCursorPlugin(this.provider.awareness, {
224
226
  cursorBuilder,
225
- cursorStateField,
226
- getSelection
227
+ getSelection,
228
+ selectionBuilder
227
229
  }, cursorStateField)];
228
230
 
229
231
  if (!disableUndo) {
@@ -112,6 +112,7 @@ var YjsExtension = (_dec = core.extension({
112
112
  destroyProvider: defaultDestroyProvider,
113
113
  syncPluginOptions: undefined,
114
114
  cursorBuilder: yProsemirror.defaultCursorBuilder,
115
+ selectionBuilder: yProsemirror.defaultSelectionBuilder,
115
116
  cursorStateField: 'cursor',
116
117
  getSelection: state => state.selection,
117
118
  disableUndo: false,
@@ -214,13 +215,14 @@ var YjsExtension = (_dec = core.extension({
214
215
  cursorStateField = _this$options.cursorStateField,
215
216
  disableUndo = _this$options.disableUndo,
216
217
  protectedNodes = _this$options.protectedNodes,
217
- trackedOrigins = _this$options.trackedOrigins;
218
+ trackedOrigins = _this$options.trackedOrigins,
219
+ selectionBuilder = _this$options.selectionBuilder;
218
220
  var yDoc = this.provider.doc;
219
221
  var type = yDoc.getXmlFragment('prosemirror');
220
222
  var plugins = [yProsemirror.ySyncPlugin(type, syncPluginOptions), yProsemirror.yCursorPlugin(this.provider.awareness, {
221
223
  cursorBuilder,
222
- cursorStateField,
223
- getSelection
224
+ getSelection,
225
+ selectionBuilder
224
226
  }, cursorStateField)];
225
227
 
226
228
  if (!disableUndo) {
@@ -1,7 +1,7 @@
1
1
  import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
2
2
  import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
4
- import { defaultCursorBuilder, ySyncPluginKey, ySyncPlugin, yCursorPlugin, defaultDeleteFilter, yUndoPlugin, yUndoPluginKey, undo, redo, absolutePositionToRelativePosition, relativePositionToAbsolutePosition } from 'y-prosemirror';
4
+ import { defaultCursorBuilder, defaultSelectionBuilder, ySyncPluginKey, ySyncPlugin, yCursorPlugin, defaultDeleteFilter, yUndoPlugin, yUndoPluginKey, undo, redo, absolutePositionToRelativePosition, relativePositionToAbsolutePosition } from 'y-prosemirror';
5
5
  import { UndoManager, transact } from 'yjs';
6
6
  import { extension, invariant, ErrorConstant, ExtensionPriority, command, keyBinding, NamedShortcut, PlainExtension, isFunction, isEmptyObject, nonChainable, convertCommand } from '@remirror/core';
7
7
  import { AnnotationExtension } from '@remirror/extension-annotation';
@@ -111,6 +111,7 @@ var YjsExtension = (_dec = extension({
111
111
  destroyProvider: defaultDestroyProvider,
112
112
  syncPluginOptions: undefined,
113
113
  cursorBuilder: defaultCursorBuilder,
114
+ selectionBuilder: defaultSelectionBuilder,
114
115
  cursorStateField: 'cursor',
115
116
  getSelection: state => state.selection,
116
117
  disableUndo: false,
@@ -213,13 +214,14 @@ var YjsExtension = (_dec = extension({
213
214
  cursorStateField = _this$options.cursorStateField,
214
215
  disableUndo = _this$options.disableUndo,
215
216
  protectedNodes = _this$options.protectedNodes,
216
- trackedOrigins = _this$options.trackedOrigins;
217
+ trackedOrigins = _this$options.trackedOrigins,
218
+ selectionBuilder = _this$options.selectionBuilder;
217
219
  var yDoc = this.provider.doc;
218
220
  var type = yDoc.getXmlFragment('prosemirror');
219
221
  var plugins = [ySyncPlugin(type, syncPluginOptions), yCursorPlugin(this.provider.awareness, {
220
222
  cursorBuilder,
221
- cursorStateField,
222
- getSelection
223
+ getSelection,
224
+ selectionBuilder
223
225
  }, cursorStateField)];
224
226
 
225
227
  if (!disableUndo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remirror/extension-yjs",
3
- "version": "1.0.28",
3
+ "version": "1.0.31",
4
4
  "description": "Realtime collaboration with yjs",
5
5
  "keywords": [
6
6
  "remirror",
@@ -44,19 +44,19 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "@babel/runtime": "^7.13.10",
47
- "@remirror/core": "^1.4.1",
48
- "@remirror/extension-annotation": "^1.1.19",
47
+ "@remirror/core": "^1.4.3",
48
+ "@remirror/extension-annotation": "^1.1.21",
49
49
  "@remirror/messages": "^1.0.6",
50
- "y-prosemirror": "^1.0.14",
50
+ "y-prosemirror": "^1.0.19",
51
51
  "y-protocols": "^1.0.5"
52
52
  },
53
53
  "devDependencies": {
54
- "@remirror/pm": "^1.0.14",
54
+ "@remirror/pm": "^1.0.18",
55
55
  "y-webrtc": "^10.2.2",
56
56
  "yjs": "^13.5.23"
57
57
  },
58
58
  "peerDependencies": {
59
- "@remirror/pm": "^1.0.10",
59
+ "@remirror/pm": "^1.0.18",
60
60
  "yjs": "^13.4.0"
61
61
  },
62
62
  "publishConfig": {