@atlaskit/prosemirror-collab 0.15.0 → 0.16.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/prosemirror-collab
2
2
 
3
+ ## 0.16.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#140816](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140816)
8
+ [`09580d6d7c275`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/09580d6d7c275) -
9
+ EDITOR-608 Clean up platform_editor_collab_text_selection_override
10
+
11
+ ## 0.16.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#131596](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131596)
16
+ [`7482e321a16a7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7482e321a16a7) -
17
+ ED-25490 added platform_editor_collab_text_selection_override. When the feature flag (FG) is
18
+ enabled, we create a new TextSelection in packages/editor/prosemirror-collab/src/index.ts during
19
+ the mapping of text selections. This change ensures that selections don’t collapse unexpectedly in
20
+ collaborative editing scenarios. The current implementation attempts to resolve selections to a
21
+ valid inline content position, but we intentionally allow selections to start at the first
22
+ position in the document (position 0), which corresponds to the doc node and isn’t inline content.
23
+ This adjustment accommodates collaborative users by preserving their selections even at the
24
+ document’s start.
25
+
3
26
  ## 0.15.0
4
27
 
5
28
  ### Minor Changes
package/dist/cjs/index.js CHANGED
@@ -67,7 +67,8 @@ function unconfirmedFrom(transform) {
67
67
  for (var i = 0; i < transform.steps.length; i++) {
68
68
  // Filter out the analytics steps, they don't need to be sent to the collab service
69
69
  // Commented out because it broke undo behaviour
70
- // TODO: Figure out how it broke undo
70
+
71
+ // TODO: ED-26957 - Figure out how it broke undo
71
72
  // if (transform.steps[i] instanceof AnalyticsStep) {
72
73
  // continue;
73
74
  // }
@@ -220,7 +221,7 @@ function receiveTransaction(state, steps, clientIDs) {
220
221
  }
221
222
  var newCollabState = new CollabState(version, unconfirmed);
222
223
  if (options && options.mapSelectionBackward && state.selection instanceof _state.TextSelection) {
223
- tr.setSelection(_state.TextSelection.between(tr.doc.resolve(tr.mapping.map(state.selection.anchor, -1)), tr.doc.resolve(tr.mapping.map(state.selection.head, -1)), -1));
224
+ tr.setSelection(new _state.TextSelection(tr.doc.resolve(tr.mapping.map(state.selection.anchor, -1)), tr.doc.resolve(tr.mapping.map(state.selection.head, -1))));
224
225
  // Ignored via go/ees005
225
226
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
227
  tr.updated &= ~1;
@@ -56,7 +56,8 @@ function unconfirmedFrom(transform) {
56
56
  for (let i = 0; i < transform.steps.length; i++) {
57
57
  // Filter out the analytics steps, they don't need to be sent to the collab service
58
58
  // Commented out because it broke undo behaviour
59
- // TODO: Figure out how it broke undo
59
+
60
+ // TODO: ED-26957 - Figure out how it broke undo
60
61
  // if (transform.steps[i] instanceof AnalyticsStep) {
61
62
  // continue;
62
63
  // }
@@ -205,7 +206,7 @@ export function receiveTransaction(state, steps, clientIDs, options = {}) {
205
206
  }
206
207
  const newCollabState = new CollabState(version, unconfirmed);
207
208
  if (options && options.mapSelectionBackward && state.selection instanceof TextSelection) {
208
- tr.setSelection(TextSelection.between(tr.doc.resolve(tr.mapping.map(state.selection.anchor, -1)), tr.doc.resolve(tr.mapping.map(state.selection.head, -1)), -1));
209
+ tr.setSelection(new TextSelection(tr.doc.resolve(tr.mapping.map(state.selection.anchor, -1)), tr.doc.resolve(tr.mapping.map(state.selection.head, -1))));
209
210
  // Ignored via go/ees005
210
211
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
211
212
  tr.updated &= ~1;
package/dist/esm/index.js CHANGED
@@ -54,7 +54,8 @@ function unconfirmedFrom(transform) {
54
54
  for (var i = 0; i < transform.steps.length; i++) {
55
55
  // Filter out the analytics steps, they don't need to be sent to the collab service
56
56
  // Commented out because it broke undo behaviour
57
- // TODO: Figure out how it broke undo
57
+
58
+ // TODO: ED-26957 - Figure out how it broke undo
58
59
  // if (transform.steps[i] instanceof AnalyticsStep) {
59
60
  // continue;
60
61
  // }
@@ -207,7 +208,7 @@ export function receiveTransaction(state, steps, clientIDs) {
207
208
  }
208
209
  var newCollabState = new CollabState(version, unconfirmed);
209
210
  if (options && options.mapSelectionBackward && state.selection instanceof TextSelection) {
210
- tr.setSelection(TextSelection.between(tr.doc.resolve(tr.mapping.map(state.selection.anchor, -1)), tr.doc.resolve(tr.mapping.map(state.selection.head, -1)), -1));
211
+ tr.setSelection(new TextSelection(tr.doc.resolve(tr.mapping.map(state.selection.anchor, -1)), tr.doc.resolve(tr.mapping.map(state.selection.head, -1))));
211
212
  // Ignored via go/ees005
212
213
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
213
214
  tr.updated &= ~1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/prosemirror-collab",
3
- "version": "0.15.0",
3
+ "version": "0.16.1",
4
4
  "description": "Collaborative editing for ProseMirror - Atlassian Fork",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"