@atlaskit/editor-plugin-collab-edit 4.1.0 → 4.1.2

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,23 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 4.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#191913](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/191913)
8
+ [`6d1e56695e91d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6d1e56695e91d) -
9
+ EDITOR-1131 Bump adf-schema package to 50.0.0
10
+ - Updated dependencies
11
+
12
+ ## 4.1.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#186446](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/186446)
17
+ [`2f05ee4fe3130`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2f05ee4fe3130) -
18
+ Enables the collab telepointer to send a custom selection to remote instead of the one defined on
19
+ the transaction
20
+
3
21
  ## 4.1.0
4
22
 
5
23
  ### Minor Changes
@@ -49,31 +49,49 @@ var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
49
49
  var selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
50
50
  var participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
51
51
  if ((0, _platformFeatureFlags.fg)('platform_editor_ai_in_document_streaming')) {
52
+ if (!sessionId || viewMode !== 'edit') {
53
+ return;
54
+ }
55
+
52
56
  // uiEvent is standard metdata (docs: https://prosemirror.net/docs/ref/#state.Transaction)
53
57
  var isPaste = (docChangedTransaction === null || docChangedTransaction === void 0 ? void 0 : docChangedTransaction.getMeta('uiEvent')) === 'paste';
54
- if (sessionId && viewMode === 'edit' && (
58
+
59
+ // If this metadata is truthy then it means a selection bookmark might be declared as the meta value OR the transaction
60
+ // doesn't want the tr.selection to be sent to remote users at all.
61
+ var remoteSelectionBookmark = originalTransaction.getMeta('useSelectionBookmarkForRemote');
62
+ if (!!remoteSelectionBookmark) {
63
+ if (remoteSelectionBookmark !== true && 'resolve' in remoteSelectionBookmark) {
64
+ var selection = remoteSelectionBookmark.resolve(newEditorState.doc);
65
+ var message = {
66
+ type: 'telepointer',
67
+ selection: (0, _actions.getSendableSelection)(selection),
68
+ sessionId: sessionId
69
+ };
70
+ provider.sendMessage(message);
71
+ }
72
+ } else if (
55
73
  // Broadcast the position if the selection has changed, and the doc hasn't changed (it is mapped
56
74
  // by the receiver).
57
75
  // If we're pasting content though make an exception (as doc has changed)
58
76
  // as on a ranged selection it results in not clearing the ranged selection after the paste
59
- selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad)) {
60
- var selection = (0, _actions.getSendableSelection)(newEditorState.selection);
61
- var message = {
77
+ selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad) {
78
+ var _selection = (0, _actions.getSendableSelection)(newEditorState.selection);
79
+ var _message = {
62
80
  type: 'telepointer',
63
- selection: selection,
81
+ selection: _selection,
64
82
  sessionId: sessionId
65
83
  };
66
- provider.sendMessage(message);
84
+ provider.sendMessage(_message);
67
85
  }
68
86
  } else {
69
87
  if (sessionId && viewMode === 'edit' && (selectionChanged && !docChangedTransaction || participantsChanged && !hideTelecursorOnLoad)) {
70
- var _selection = (0, _actions.getSendableSelection)(newEditorState.selection);
71
- var _message = {
88
+ var _selection2 = (0, _actions.getSendableSelection)(newEditorState.selection);
89
+ var _message2 = {
72
90
  type: 'telepointer',
73
- selection: _selection,
91
+ selection: _selection2,
74
92
  sessionId: sessionId
75
93
  };
76
- provider.sendMessage(_message);
94
+ provider.sendMessage(_message2);
77
95
  }
78
96
  }
79
97
  };
@@ -44,14 +44,32 @@ export const sendTransaction = ({
44
44
  const selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
45
45
  const participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
46
46
  if (fg('platform_editor_ai_in_document_streaming')) {
47
+ if (!sessionId || viewMode !== 'edit') {
48
+ return;
49
+ }
50
+
47
51
  // uiEvent is standard metdata (docs: https://prosemirror.net/docs/ref/#state.Transaction)
48
52
  const isPaste = (docChangedTransaction === null || docChangedTransaction === void 0 ? void 0 : docChangedTransaction.getMeta('uiEvent')) === 'paste';
49
- if (sessionId && viewMode === 'edit' && (
53
+
54
+ // If this metadata is truthy then it means a selection bookmark might be declared as the meta value OR the transaction
55
+ // doesn't want the tr.selection to be sent to remote users at all.
56
+ const remoteSelectionBookmark = originalTransaction.getMeta('useSelectionBookmarkForRemote');
57
+ if (!!remoteSelectionBookmark) {
58
+ if (remoteSelectionBookmark !== true && 'resolve' in remoteSelectionBookmark) {
59
+ const selection = remoteSelectionBookmark.resolve(newEditorState.doc);
60
+ const message = {
61
+ type: 'telepointer',
62
+ selection: getSendableSelection(selection),
63
+ sessionId
64
+ };
65
+ provider.sendMessage(message);
66
+ }
67
+ } else if (
50
68
  // Broadcast the position if the selection has changed, and the doc hasn't changed (it is mapped
51
69
  // by the receiver).
52
70
  // If we're pasting content though make an exception (as doc has changed)
53
71
  // as on a ranged selection it results in not clearing the ranged selection after the paste
54
- selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad)) {
72
+ selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad) {
55
73
  const selection = getSendableSelection(newEditorState.selection);
56
74
  const message = {
57
75
  type: 'telepointer',
@@ -43,31 +43,49 @@ export var sendTransaction = function sendTransaction(_ref) {
43
43
  var selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
44
44
  var participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
45
45
  if (fg('platform_editor_ai_in_document_streaming')) {
46
+ if (!sessionId || viewMode !== 'edit') {
47
+ return;
48
+ }
49
+
46
50
  // uiEvent is standard metdata (docs: https://prosemirror.net/docs/ref/#state.Transaction)
47
51
  var isPaste = (docChangedTransaction === null || docChangedTransaction === void 0 ? void 0 : docChangedTransaction.getMeta('uiEvent')) === 'paste';
48
- if (sessionId && viewMode === 'edit' && (
52
+
53
+ // If this metadata is truthy then it means a selection bookmark might be declared as the meta value OR the transaction
54
+ // doesn't want the tr.selection to be sent to remote users at all.
55
+ var remoteSelectionBookmark = originalTransaction.getMeta('useSelectionBookmarkForRemote');
56
+ if (!!remoteSelectionBookmark) {
57
+ if (remoteSelectionBookmark !== true && 'resolve' in remoteSelectionBookmark) {
58
+ var selection = remoteSelectionBookmark.resolve(newEditorState.doc);
59
+ var message = {
60
+ type: 'telepointer',
61
+ selection: getSendableSelection(selection),
62
+ sessionId: sessionId
63
+ };
64
+ provider.sendMessage(message);
65
+ }
66
+ } else if (
49
67
  // Broadcast the position if the selection has changed, and the doc hasn't changed (it is mapped
50
68
  // by the receiver).
51
69
  // If we're pasting content though make an exception (as doc has changed)
52
70
  // as on a ranged selection it results in not clearing the ranged selection after the paste
53
- selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad)) {
54
- var selection = getSendableSelection(newEditorState.selection);
55
- var message = {
71
+ selectionChanged && (!docChangedTransaction || isPaste) || participantsChanged && !hideTelecursorOnLoad) {
72
+ var _selection = getSendableSelection(newEditorState.selection);
73
+ var _message = {
56
74
  type: 'telepointer',
57
- selection: selection,
75
+ selection: _selection,
58
76
  sessionId: sessionId
59
77
  };
60
- provider.sendMessage(message);
78
+ provider.sendMessage(_message);
61
79
  }
62
80
  } else {
63
81
  if (sessionId && viewMode === 'edit' && (selectionChanged && !docChangedTransaction || participantsChanged && !hideTelecursorOnLoad)) {
64
- var _selection = getSendableSelection(newEditorState.selection);
65
- var _message = {
82
+ var _selection2 = getSendableSelection(newEditorState.selection);
83
+ var _message2 = {
66
84
  type: 'telepointer',
67
- selection: _selection,
85
+ selection: _selection2,
68
86
  sessionId: sessionId
69
87
  };
70
- provider.sendMessage(_message);
88
+ provider.sendMessage(_message2);
71
89
  }
72
90
  }
73
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  ".": "./src/index.ts"
31
31
  },
32
32
  "dependencies": {
33
- "@atlaskit/adf-schema": "^49.0.6",
33
+ "@atlaskit/adf-schema": "^50.0.1",
34
34
  "@atlaskit/custom-steps": "^0.11.0",
35
35
  "@atlaskit/editor-json-transformer": "^8.24.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
@@ -42,12 +42,12 @@
42
42
  "@atlaskit/frontend-utilities": "^3.1.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
44
  "@atlaskit/prosemirror-collab": "^0.17.0",
45
- "@atlaskit/tmp-editor-statsig": "^9.9.0",
45
+ "@atlaskit/tmp-editor-statsig": "^9.17.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "memoize-one": "^6.0.0"
48
48
  },
49
49
  "peerDependencies": {
50
- "@atlaskit/editor-common": "^107.9.0",
50
+ "@atlaskit/editor-common": "^107.12.0",
51
51
  "react": "^18.2.0",
52
52
  "react-dom": "^18.2.0"
53
53
  },