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

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,20 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 4.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#195649](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/195649)
14
+ [`231bb33e06dfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/231bb33e06dfe) -
15
+ EDITOR-1131 Bump adf-schema version to 50.2.0
16
+ - Updated dependencies
17
+
3
18
  ## 4.1.2
4
19
 
5
20
  ### Patch Changes
@@ -26,13 +26,12 @@ var isLocked = function isLocked(step) {
26
26
  */
27
27
  function mergeUnconfirmedSteps(steps, api) {
28
28
  var mergedSteps = steps.reduce(function (acc, rebaseable) {
29
- var _api$connectivity, _api$collabEdit$share;
29
+ var _api$connectivity;
30
30
  var lastStep = acc[acc.length - 1];
31
31
  var isOffline = (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline';
32
- var activeParticipants = api === null || api === void 0 || (_api$collabEdit$share = api.collabEdit.sharedState.currentState()) === null || _api$collabEdit$share === void 0 || (_api$collabEdit$share = _api$collabEdit$share.activeParticipants) === null || _api$collabEdit$share === void 0 ? void 0 : _api$collabEdit$share.toArray();
33
- var isSinglePlayer = (0, _expValEquals.expValEquals)('platform_editor_enable_single_player_step_merging', 'isEnabled', true) && activeParticipants && activeParticipants.length === 1;
34
- var isOfflineOrSinglePlayer = isOffline || isSinglePlayer;
35
- if (isOfflineOrSinglePlayer && lastStep && !isLocked(lastStep) && !isLocked(rebaseable)) {
32
+ var isOnlineMergeEnabled = (0, _expValEquals.expValEquals)('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
33
+ var isMergingEnabled = isOffline || isOnlineMergeEnabled;
34
+ if (isMergingEnabled && lastStep && !isLocked(lastStep) && !isLocked(rebaseable)) {
36
35
  var mergedStep = lastStep.step.merge(rebaseable.step);
37
36
  var inverted = rebaseable.inverted.merge(lastStep.inverted);
38
37
  // Always take the origin of the new step.
@@ -81,12 +81,14 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
81
81
  fullNameEl.textContent = fullName;
82
82
  fullNameEl.className = 'telepointer-fullname';
83
83
  fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
84
+ fullNameEl.style.color = avatarColor.textColor;
84
85
  fullNameEl.setAttribute('aria-hidden', 'true');
85
86
  cursor.appendChild(fullNameEl);
86
87
  var initialEl = document.createElement('span');
87
88
  initialEl.textContent = initial;
88
89
  initialEl.className = 'telepointer-initial';
89
90
  initialEl.style.backgroundColor = avatarColor.backgroundColor;
91
+ initialEl.style.color = avatarColor.textColor;
90
92
  initialEl.setAttribute('aria-hidden', 'true');
91
93
  cursor.appendChild(initialEl);
92
94
  }
@@ -20,13 +20,12 @@ const isLocked = step => {
20
20
  */
21
21
  export function mergeUnconfirmedSteps(steps, api) {
22
22
  const mergedSteps = steps.reduce((acc, rebaseable) => {
23
- var _api$connectivity, _api$connectivity$sha, _api$collabEdit$share, _api$collabEdit$share2;
23
+ var _api$connectivity, _api$connectivity$sha;
24
24
  const lastStep = acc[acc.length - 1];
25
25
  const isOffline = (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState.currentState()) === null || _api$connectivity$sha === void 0 ? void 0 : _api$connectivity$sha.mode) === 'offline';
26
- const activeParticipants = api === null || api === void 0 ? void 0 : (_api$collabEdit$share = api.collabEdit.sharedState.currentState()) === null || _api$collabEdit$share === void 0 ? void 0 : (_api$collabEdit$share2 = _api$collabEdit$share.activeParticipants) === null || _api$collabEdit$share2 === void 0 ? void 0 : _api$collabEdit$share2.toArray();
27
- const isSinglePlayer = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true) && activeParticipants && activeParticipants.length === 1;
28
- const isOfflineOrSinglePlayer = isOffline || isSinglePlayer;
29
- if (isOfflineOrSinglePlayer && lastStep && !isLocked(lastStep) && !isLocked(rebaseable)) {
26
+ const isOnlineMergeEnabled = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
27
+ const isMergingEnabled = isOffline || isOnlineMergeEnabled;
28
+ if (isMergingEnabled && lastStep && !isLocked(lastStep) && !isLocked(rebaseable)) {
30
29
  const mergedStep = lastStep.step.merge(rebaseable.step);
31
30
  const inverted = rebaseable.inverted.merge(lastStep.inverted);
32
31
  // Always take the origin of the new step.
@@ -63,12 +63,14 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
63
63
  fullNameEl.textContent = fullName;
64
64
  fullNameEl.className = 'telepointer-fullname';
65
65
  fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
66
+ fullNameEl.style.color = avatarColor.textColor;
66
67
  fullNameEl.setAttribute('aria-hidden', 'true');
67
68
  cursor.appendChild(fullNameEl);
68
69
  const initialEl = document.createElement('span');
69
70
  initialEl.textContent = initial;
70
71
  initialEl.className = 'telepointer-initial';
71
72
  initialEl.style.backgroundColor = avatarColor.backgroundColor;
73
+ initialEl.style.color = avatarColor.textColor;
72
74
  initialEl.setAttribute('aria-hidden', 'true');
73
75
  cursor.appendChild(initialEl);
74
76
  }
@@ -20,13 +20,12 @@ var isLocked = function isLocked(step) {
20
20
  */
21
21
  export function mergeUnconfirmedSteps(steps, api) {
22
22
  var mergedSteps = steps.reduce(function (acc, rebaseable) {
23
- var _api$connectivity, _api$collabEdit$share;
23
+ var _api$connectivity;
24
24
  var lastStep = acc[acc.length - 1];
25
25
  var isOffline = (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline';
26
- var activeParticipants = api === null || api === void 0 || (_api$collabEdit$share = api.collabEdit.sharedState.currentState()) === null || _api$collabEdit$share === void 0 || (_api$collabEdit$share = _api$collabEdit$share.activeParticipants) === null || _api$collabEdit$share === void 0 ? void 0 : _api$collabEdit$share.toArray();
27
- var isSinglePlayer = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true) && activeParticipants && activeParticipants.length === 1;
28
- var isOfflineOrSinglePlayer = isOffline || isSinglePlayer;
29
- if (isOfflineOrSinglePlayer && lastStep && !isLocked(lastStep) && !isLocked(rebaseable)) {
26
+ var isOnlineMergeEnabled = expValEquals('platform_editor_enable_single_player_step_merging', 'isEnabled', true);
27
+ var isMergingEnabled = isOffline || isOnlineMergeEnabled;
28
+ if (isMergingEnabled && lastStep && !isLocked(lastStep) && !isLocked(rebaseable)) {
30
29
  var mergedStep = lastStep.step.merge(rebaseable.step);
31
30
  var inverted = rebaseable.inverted.merge(lastStep.inverted);
32
31
  // Always take the origin of the new step.
@@ -72,12 +72,14 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
72
72
  fullNameEl.textContent = fullName;
73
73
  fullNameEl.className = 'telepointer-fullname';
74
74
  fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
75
+ fullNameEl.style.color = avatarColor.textColor;
75
76
  fullNameEl.setAttribute('aria-hidden', 'true');
76
77
  cursor.appendChild(fullNameEl);
77
78
  var initialEl = document.createElement('span');
78
79
  initialEl.textContent = initial;
79
80
  initialEl.className = 'telepointer-initial';
80
81
  initialEl.style.backgroundColor = avatarColor.backgroundColor;
82
+ initialEl.style.color = avatarColor.textColor;
81
83
  initialEl.setAttribute('aria-hidden', 'true');
82
84
  cursor.appendChild(initialEl);
83
85
  }
@@ -1,6 +1,7 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { type CollabEditOptions, type CollabParticipant } from '@atlaskit/editor-common/collab';
3
3
  import { type EditorState, type ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
5
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
5
6
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
@@ -15,7 +16,7 @@ export declare const createTelepointers: (from: number, to: number, sessionId: s
15
16
  export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => Transaction;
16
17
  export declare const scrollToCollabCursor: (editorView: EditorView, participants: CollabParticipant[], sessionId: string | undefined, index: number, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => void;
17
18
  export declare const getPositionOfTelepointer: (sessionId: string, decorationSet: DecorationSet) => undefined | number;
18
- export declare const isReplaceStep: (step: Step) => boolean;
19
+ export declare const isReplaceStep: (step: Step) => step is ReplaceStep;
19
20
  export declare const originalTransactionHasMeta: (transaction: Transaction | ReadonlyTransaction, metaTag: string) => boolean;
20
21
  /**
21
22
  * Takes the transaction and editor state and checks if the transaction is considered organic change
@@ -1,6 +1,7 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { type CollabEditOptions, type CollabParticipant } from '@atlaskit/editor-common/collab';
3
3
  import { type EditorState, type ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
4
5
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
5
6
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
6
7
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
@@ -15,7 +16,7 @@ export declare const createTelepointers: (from: number, to: number, sessionId: s
15
16
  export declare const replaceDocument: (doc: any, state: EditorState, version?: number, options?: CollabEditOptions, reserveCursor?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI) => Transaction;
16
17
  export declare const scrollToCollabCursor: (editorView: EditorView, participants: CollabParticipant[], sessionId: string | undefined, index: number, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => void;
17
18
  export declare const getPositionOfTelepointer: (sessionId: string, decorationSet: DecorationSet) => undefined | number;
18
- export declare const isReplaceStep: (step: Step) => boolean;
19
+ export declare const isReplaceStep: (step: Step) => step is ReplaceStep;
19
20
  export declare const originalTransactionHasMeta: (transaction: Transaction | ReadonlyTransaction, metaTag: string) => boolean;
20
21
  /**
21
22
  * Takes the transaction and editor state and checks if the transaction is considered organic change
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,24 +30,24 @@
30
30
  ".": "./src/index.ts"
31
31
  },
32
32
  "dependencies": {
33
- "@atlaskit/adf-schema": "^50.0.1",
33
+ "@atlaskit/adf-schema": "^50.2.0",
34
34
  "@atlaskit/custom-steps": "^0.11.0",
35
- "@atlaskit/editor-json-transformer": "^8.24.0",
35
+ "@atlaskit/editor-json-transformer": "^8.25.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
37
37
  "@atlaskit/editor-plugin-connectivity": "^3.1.0",
38
38
  "@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
39
39
  "@atlaskit/editor-plugin-feature-flags": "^2.0.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
- "@atlaskit/editor-shared-styles": "^3.5.0",
41
+ "@atlaskit/editor-shared-styles": "^3.6.0",
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.17.0",
45
+ "@atlaskit/tmp-editor-statsig": "^10.0.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.12.0",
50
+ "@atlaskit/editor-common": "^107.25.0",
51
51
  "react": "^18.2.0",
52
52
  "react-dom": "^18.2.0"
53
53
  },
@@ -61,10 +61,9 @@
61
61
  "@atlaskit/editor-test-helpers": "workspace:^",
62
62
  "@atlaskit/ssr": "workspace:^",
63
63
  "@atlaskit/synchrony-test-helpers": "workspace:^",
64
- "@atlaskit/util-data-test": "^18.0.0",
64
+ "@atlaskit/util-data-test": "^18.1.0",
65
65
  "@atlaskit/visual-regression": "workspace:^",
66
66
  "@testing-library/react": "^13.4.0",
67
- "typescript": "~5.4.2",
68
67
  "wait-for-expect": "^1.2.0"
69
68
  },
70
69
  "techstack": {