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

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,21 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 4.1.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`128002718ba34`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/128002718ba34) -
8
+ confluence_team_presence_scroll_to_pointer feature flag cleaned up
9
+ - Updated dependencies
10
+
11
+ ## 4.1.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`6ca68bbf39757`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6ca68bbf39757) -
16
+ Change all AIFC feature gates over to an experiment platform_editor_ai_aifc
17
+ - Updated dependencies
18
+
3
19
  ## 4.1.4
4
20
 
5
21
  ### Patch Changes
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.sendTransaction = void 0;
7
7
  var _steps = require("@atlaskit/adf-schema/steps");
8
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
8
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
10
9
  var _actions = require("../actions");
11
10
  var _pluginKey = require("../main/plugin-key");
@@ -48,7 +47,7 @@ var sendTransaction = exports.sendTransaction = function sendTransaction(_ref) {
48
47
  sessionId = currentPluginState.sessionId;
49
48
  var selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
50
49
  var participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
51
- if ((0, _platformFeatureFlags.fg)('platform_editor_ai_in_document_streaming')) {
50
+ if ((0, _experiments.editorExperiment)('platform_editor_ai_aifc', true)) {
52
51
  if (!sessionId || viewMode !== 'edit') {
53
52
  return;
54
53
  }
@@ -12,7 +12,7 @@ var _browser = require("@atlaskit/editor-common/browser");
12
12
  var _collab = require("@atlaskit/editor-common/collab");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
14
  var _view = require("@atlaskit/editor-prosemirror/view");
15
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
16
  var _participants = require("../participants");
17
17
  var _utils = require("../utils");
18
18
  /**
@@ -113,12 +113,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
113
113
 
114
114
  // Remove telepointers for users that left
115
115
  left.forEach(function (i) {
116
- var pointers;
117
- if ((0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
118
- pointers = (0, _utils.findPointers)(_this.getPresenceId(i.sessionId), _this.decorationSet);
119
- } else {
120
- pointers = (0, _utils._findPointers)(i.sessionId, _this.decorationSet);
121
- }
116
+ var pointers = (0, _utils.findPointers)(_this.getPresenceId(i.sessionId), _this.decorationSet);
122
117
  if (pointers) {
123
118
  remove = remove.concat(pointers);
124
119
  }
@@ -127,12 +122,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
127
122
  if (telepointerData) {
128
123
  var sessionId = telepointerData.sessionId;
129
124
  if (participants.get(sessionId) && sessionId !== sid) {
130
- var oldPointers;
131
- if ((0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
132
- oldPointers = (0, _utils.findPointers)(this.getPresenceId(sessionId), this.decorationSet);
133
- } else {
134
- oldPointers = (0, _utils._findPointers)(sessionId, this.decorationSet);
135
- }
125
+ var oldPointers = (0, _utils.findPointers)(this.getPresenceId(sessionId), this.decorationSet);
136
126
  if (oldPointers) {
137
127
  remove = remove.concat(oldPointers);
138
128
  }
@@ -156,7 +146,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
156
146
  } catch (err) {
157
147
  this.onError(err);
158
148
  }
159
- add = add.concat((0, _utils.createTelepointers)(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), (0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer') ? (0, _utils.hasExistingNudge)(sessionId, this.nudgeAnimations) : false));
149
+ add = add.concat((0, _utils.createTelepointers)(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), (0, _utils.hasExistingNudge)(sessionId, this.nudgeAnimations)));
160
150
  }
161
151
  }
162
152
  if (tr.docChanged) {
@@ -175,7 +165,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
175
165
  size = _ref.slice.content.size,
176
166
  _from = _ref.from;
177
167
  var pos = getValidPos(tr, size ? Math.min(_from + size, tr.doc.nodeSize - 3) : Math.max(_from, 1));
178
- add = add.concat((0, _utils.createTelepointers)(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId), (0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer') ? (0, _utils.hasExistingNudge)(_sessionId, _this.nudgeAnimations) : false));
168
+ add = add.concat((0, _utils.createTelepointers)(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId), (0, _utils.hasExistingNudge)(_sessionId, _this.nudgeAnimations)));
179
169
  }
180
170
  }
181
171
  }
@@ -183,7 +173,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
183
173
  } catch (err) {
184
174
  this.onError(err);
185
175
  }
186
- if (!(0, _platformFeatureFlags.fg)('platform_editor_ai_in_document_streaming')) {
176
+ if (!(0, _experiments.editorExperiment)('platform_editor_ai_aifc', true)) {
187
177
  // Remove any selection decoration within the change range,
188
178
  // takes care of the issue when after pasting we end up with a dead selection
189
179
  tr.steps.filter(_utils.isReplaceStep).forEach(function (s) {
@@ -229,7 +219,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
229
219
  }
230
220
  }
231
221
  });
232
- if (nudgeTelepointerData && (0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
222
+ if (nudgeTelepointerData) {
233
223
  var nudgeSessionId = nudgeTelepointerData === null || nudgeTelepointerData === void 0 ? void 0 : nudgeTelepointerData.sessionId;
234
224
 
235
225
  // Ignored via go/ees005
@@ -264,11 +254,7 @@ var PluginState = exports.PluginState = /*#__PURE__*/function () {
264
254
  }
265
255
  }
266
256
  }
267
- if ((0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
268
- var _nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised, this.onError, this.nudgeAnimations);
269
- return PluginState.eq(_nextState, this) ? this : _nextState;
270
- }
271
- var nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised);
257
+ var nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised, this.onError, this.nudgeAnimations);
272
258
  return PluginState.eq(nextState, this) ? this : nextState;
273
259
  }
274
260
  }], [{
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.findPointers = exports.createTelepointers = exports._findPointers = void 0;
7
+ exports.findPointers = exports.createTelepointers = void 0;
8
8
  exports.getAvatarColor = getAvatarColor;
9
9
  exports.scrollToCollabCursor = exports.replaceDocument = exports.originalTransactionHasMeta = exports.isReplaceStep = exports.isOrganicChange = exports.hasExistingNudge = exports.getPositionOfTelepointer = void 0;
10
10
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
@@ -17,12 +17,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
17
17
  var _transform = require("@atlaskit/editor-prosemirror/transform");
18
18
  var _view = require("@atlaskit/editor-prosemirror/view");
19
19
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
20
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
- var _findPointers = exports._findPointers = function _findPointers(id, decorations) {
22
- return decorations.find().reduce(function (arr, deco) {
23
- return deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr;
24
- }, []);
25
- };
26
20
  var findPointers = exports.findPointers = function findPointers(id, decorations) {
27
21
  return decorations.find().reduce(function (arr, deco) {
28
22
  return deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr;
@@ -69,29 +63,28 @@ var createTelepointers = exports.createTelepointers = function createTelepointer
69
63
  cursor.setAttribute('data-initial', initial);
70
64
  cursor.setAttribute('aria-label', "".concat(fullName, " cursor position"));
71
65
  cursor.setAttribute('role', 'button');
72
- if ((0, _platformFeatureFlags.fg)('confluence_team_presence_scroll_to_pointer')) {
73
- cursor.setAttribute(_collab.TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
74
- // If there is an ongoing expand animation, we'll keep the telepointer expanded
75
- // until the keyframe animation is complete. Please note that this will restart the anim timer
76
- // from 0 everytime it's re-added.
77
- if (isNudged) {
78
- cursor.classList.add(_collab.TELEPOINTER_PULSE_DURING_TR_CLASS);
79
- }
80
- var fullNameEl = document.createElement('span');
81
- fullNameEl.textContent = fullName;
82
- fullNameEl.className = 'telepointer-fullname';
83
- fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
84
- fullNameEl.style.color = avatarColor.textColor;
85
- fullNameEl.setAttribute('aria-hidden', 'true');
86
- cursor.appendChild(fullNameEl);
87
- var initialEl = document.createElement('span');
88
- initialEl.textContent = initial;
89
- initialEl.className = 'telepointer-initial';
90
- initialEl.style.backgroundColor = avatarColor.backgroundColor;
91
- initialEl.style.color = avatarColor.textColor;
92
- initialEl.setAttribute('aria-hidden', 'true');
93
- cursor.appendChild(initialEl);
66
+ cursor.setAttribute(_collab.TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
67
+
68
+ // If there is an ongoing expand animation, we'll keep the telepointer expanded
69
+ // until the keyframe animation is complete. Please note that this will restart the anim timer
70
+ // from 0 everytime it's re-added.
71
+ if (isNudged) {
72
+ cursor.classList.add(_collab.TELEPOINTER_PULSE_DURING_TR_CLASS);
94
73
  }
74
+ var fullNameEl = document.createElement('span');
75
+ fullNameEl.textContent = fullName;
76
+ fullNameEl.className = 'telepointer-fullname';
77
+ fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
78
+ fullNameEl.style.color = avatarColor.textColor;
79
+ fullNameEl.setAttribute('aria-hidden', 'true');
80
+ cursor.appendChild(fullNameEl);
81
+ var initialEl = document.createElement('span');
82
+ initialEl.textContent = initial;
83
+ initialEl.className = 'telepointer-initial';
84
+ initialEl.style.backgroundColor = avatarColor.backgroundColor;
85
+ initialEl.style.color = avatarColor.textColor;
86
+ initialEl.setAttribute('aria-hidden', 'true');
87
+ cursor.appendChild(initialEl);
95
88
  return decorations.concat(_view.Decoration.widget(to, spaceJoinerAfter, {
96
89
  pointer: {
97
90
  sessionId: sessionId,
@@ -1,5 +1,4 @@
1
1
  import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
3
  import { getSendableSelection } from '../actions';
5
4
  import { pluginKey } from '../main/plugin-key';
@@ -43,7 +42,7 @@ export const sendTransaction = ({
43
42
  } = currentPluginState;
44
43
  const selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
45
44
  const participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
46
- if (fg('platform_editor_ai_in_document_streaming')) {
45
+ if (editorExperiment('platform_editor_ai_aifc', true)) {
47
46
  if (!sessionId || viewMode !== 'edit') {
48
47
  return;
49
48
  }
@@ -3,9 +3,9 @@ import { browser } from '@atlaskit/editor-common/browser';
3
3
  import { TELEPOINTER_DIM_CLASS, TELEPOINTER_PULSE_CLASS, TELEPOINTER_PULSE_DURING_TR_CLASS } from '@atlaskit/editor-common/collab';
4
4
  import { Selection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
- import { fg } from '@atlaskit/platform-feature-flags';
6
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
7
7
  import { Participants } from '../participants';
8
- import { createTelepointers, _findPointers, findPointers, getPositionOfTelepointer, isReplaceStep, hasExistingNudge } from '../utils';
8
+ import { createTelepointers, findPointers, getPositionOfTelepointer, isReplaceStep, hasExistingNudge } from '../utils';
9
9
 
10
10
  /**
11
11
  * Returns position where it's possible to place a decoration.
@@ -84,12 +84,7 @@ export class PluginState {
84
84
 
85
85
  // Remove telepointers for users that left
86
86
  left.forEach(i => {
87
- let pointers;
88
- if (fg('confluence_team_presence_scroll_to_pointer')) {
89
- pointers = findPointers(this.getPresenceId(i.sessionId), this.decorationSet);
90
- } else {
91
- pointers = _findPointers(i.sessionId, this.decorationSet);
92
- }
87
+ const pointers = findPointers(this.getPresenceId(i.sessionId), this.decorationSet);
93
88
  if (pointers) {
94
89
  remove = remove.concat(pointers);
95
90
  }
@@ -100,12 +95,7 @@ export class PluginState {
100
95
  sessionId
101
96
  } = telepointerData;
102
97
  if (participants.get(sessionId) && sessionId !== sid) {
103
- let oldPointers;
104
- if (fg('confluence_team_presence_scroll_to_pointer')) {
105
- oldPointers = findPointers(this.getPresenceId(sessionId), this.decorationSet);
106
- } else {
107
- oldPointers = _findPointers(sessionId, this.decorationSet);
108
- }
98
+ const oldPointers = findPointers(this.getPresenceId(sessionId), this.decorationSet);
109
99
  if (oldPointers) {
110
100
  remove = remove.concat(oldPointers);
111
101
  }
@@ -129,7 +119,7 @@ export class PluginState {
129
119
  } catch (err) {
130
120
  this.onError(err);
131
121
  }
132
- add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), fg('confluence_team_presence_scroll_to_pointer') ? hasExistingNudge(sessionId, this.nudgeAnimations) : false));
122
+ add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations)));
133
123
  }
134
124
  }
135
125
  if (tr.docChanged) {
@@ -156,7 +146,7 @@ export class PluginState {
156
146
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
157
147
  } = step;
158
148
  const pos = getValidPos(tr, size ? Math.min(from + size, tr.doc.nodeSize - 3) : Math.max(from, 1));
159
- add = add.concat(createTelepointers(pos, pos, sessionId, false, this.getInitial(sessionId), presenceId, this.getFullName(sessionId), fg('confluence_team_presence_scroll_to_pointer') ? hasExistingNudge(sessionId, this.nudgeAnimations) : false));
149
+ add = add.concat(createTelepointers(pos, pos, sessionId, false, this.getInitial(sessionId), presenceId, this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations)));
160
150
  }
161
151
  }
162
152
  }
@@ -164,7 +154,7 @@ export class PluginState {
164
154
  } catch (err) {
165
155
  this.onError(err);
166
156
  }
167
- if (!fg('platform_editor_ai_in_document_streaming')) {
157
+ if (!editorExperiment('platform_editor_ai_aifc', true)) {
168
158
  // Remove any selection decoration within the change range,
169
159
  // takes care of the issue when after pasting we end up with a dead selection
170
160
  tr.steps.filter(isReplaceStep).forEach(s => {
@@ -213,7 +203,7 @@ export class PluginState {
213
203
  }
214
204
  }
215
205
  });
216
- if (nudgeTelepointerData && fg('confluence_team_presence_scroll_to_pointer')) {
206
+ if (nudgeTelepointerData) {
217
207
  const nudgeSessionId = nudgeTelepointerData === null || nudgeTelepointerData === void 0 ? void 0 : nudgeTelepointerData.sessionId;
218
208
 
219
209
  // Ignored via go/ees005
@@ -250,11 +240,7 @@ export class PluginState {
250
240
  }
251
241
  }
252
242
  }
253
- if (fg('confluence_team_presence_scroll_to_pointer')) {
254
- const nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised, this.onError, this.nudgeAnimations);
255
- return PluginState.eq(nextState, this) ? this : nextState;
256
- }
257
- const nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised);
243
+ const nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised, this.onError, this.nudgeAnimations);
258
244
  return PluginState.eq(nextState, this) ? this : nextState;
259
245
  }
260
246
  static eq(a, b) {
@@ -7,8 +7,6 @@ import { Transaction, Selection, TextSelection } from '@atlaskit/editor-prosemir
7
7
  import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
8
8
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
9
  import { getParticipantColor } from '@atlaskit/editor-shared-styles';
10
- import { fg } from '@atlaskit/platform-feature-flags';
11
- export const _findPointers = (id, decorations) => decorations.find().reduce((arr, deco) => deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr, []);
12
10
  export const findPointers = (id, decorations) => decorations.find().reduce((arr, deco) => deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr, []);
13
11
  function style(options) {
14
12
  const color = options && options.color || 'black';
@@ -51,29 +49,28 @@ export const createTelepointers = (from, to, sessionId, isSelection, initial, pr
51
49
  cursor.setAttribute('data-initial', initial);
52
50
  cursor.setAttribute('aria-label', `${fullName} cursor position`);
53
51
  cursor.setAttribute('role', 'button');
54
- if (fg('confluence_team_presence_scroll_to_pointer')) {
55
- cursor.setAttribute(TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
56
- // If there is an ongoing expand animation, we'll keep the telepointer expanded
57
- // until the keyframe animation is complete. Please note that this will restart the anim timer
58
- // from 0 everytime it's re-added.
59
- if (isNudged) {
60
- cursor.classList.add(TELEPOINTER_PULSE_DURING_TR_CLASS);
61
- }
62
- const fullNameEl = document.createElement('span');
63
- fullNameEl.textContent = fullName;
64
- fullNameEl.className = 'telepointer-fullname';
65
- fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
66
- fullNameEl.style.color = avatarColor.textColor;
67
- fullNameEl.setAttribute('aria-hidden', 'true');
68
- cursor.appendChild(fullNameEl);
69
- const initialEl = document.createElement('span');
70
- initialEl.textContent = initial;
71
- initialEl.className = 'telepointer-initial';
72
- initialEl.style.backgroundColor = avatarColor.backgroundColor;
73
- initialEl.style.color = avatarColor.textColor;
74
- initialEl.setAttribute('aria-hidden', 'true');
75
- cursor.appendChild(initialEl);
52
+ cursor.setAttribute(TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
53
+
54
+ // If there is an ongoing expand animation, we'll keep the telepointer expanded
55
+ // until the keyframe animation is complete. Please note that this will restart the anim timer
56
+ // from 0 everytime it's re-added.
57
+ if (isNudged) {
58
+ cursor.classList.add(TELEPOINTER_PULSE_DURING_TR_CLASS);
76
59
  }
60
+ const fullNameEl = document.createElement('span');
61
+ fullNameEl.textContent = fullName;
62
+ fullNameEl.className = 'telepointer-fullname';
63
+ fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
64
+ fullNameEl.style.color = avatarColor.textColor;
65
+ fullNameEl.setAttribute('aria-hidden', 'true');
66
+ cursor.appendChild(fullNameEl);
67
+ const initialEl = document.createElement('span');
68
+ initialEl.textContent = initial;
69
+ initialEl.className = 'telepointer-initial';
70
+ initialEl.style.backgroundColor = avatarColor.backgroundColor;
71
+ initialEl.style.color = avatarColor.textColor;
72
+ initialEl.setAttribute('aria-hidden', 'true');
73
+ cursor.appendChild(initialEl);
77
74
  return decorations.concat(Decoration.widget(to, spaceJoinerAfter, {
78
75
  pointer: {
79
76
  sessionId,
@@ -1,5 +1,4 @@
1
1
  import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
3
  import { getSendableSelection } from '../actions';
5
4
  import { pluginKey } from '../main/plugin-key';
@@ -42,7 +41,7 @@ export var sendTransaction = function sendTransaction(_ref) {
42
41
  sessionId = currentPluginState.sessionId;
43
42
  var selectionChanged = !oldEditorState.selection.eq(newEditorState.selection);
44
43
  var participantsChanged = prevActiveParticipants && !prevActiveParticipants.eq(activeParticipants);
45
- if (fg('platform_editor_ai_in_document_streaming')) {
44
+ if (editorExperiment('platform_editor_ai_aifc', true)) {
46
45
  if (!sessionId || viewMode !== 'edit') {
47
46
  return;
48
47
  }
@@ -5,9 +5,9 @@ import { browser } from '@atlaskit/editor-common/browser';
5
5
  import { TELEPOINTER_DIM_CLASS, TELEPOINTER_PULSE_CLASS, TELEPOINTER_PULSE_DURING_TR_CLASS } from '@atlaskit/editor-common/collab';
6
6
  import { Selection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
8
- import { fg } from '@atlaskit/platform-feature-flags';
8
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
9
  import { Participants } from '../participants';
10
- import { createTelepointers, _findPointers, findPointers, getPositionOfTelepointer, isReplaceStep, hasExistingNudge } from '../utils';
10
+ import { createTelepointers, findPointers, getPositionOfTelepointer, isReplaceStep, hasExistingNudge } from '../utils';
11
11
 
12
12
  /**
13
13
  * Returns position where it's possible to place a decoration.
@@ -107,12 +107,7 @@ export var PluginState = /*#__PURE__*/function () {
107
107
 
108
108
  // Remove telepointers for users that left
109
109
  left.forEach(function (i) {
110
- var pointers;
111
- if (fg('confluence_team_presence_scroll_to_pointer')) {
112
- pointers = findPointers(_this.getPresenceId(i.sessionId), _this.decorationSet);
113
- } else {
114
- pointers = _findPointers(i.sessionId, _this.decorationSet);
115
- }
110
+ var pointers = findPointers(_this.getPresenceId(i.sessionId), _this.decorationSet);
116
111
  if (pointers) {
117
112
  remove = remove.concat(pointers);
118
113
  }
@@ -121,12 +116,7 @@ export var PluginState = /*#__PURE__*/function () {
121
116
  if (telepointerData) {
122
117
  var sessionId = telepointerData.sessionId;
123
118
  if (participants.get(sessionId) && sessionId !== sid) {
124
- var oldPointers;
125
- if (fg('confluence_team_presence_scroll_to_pointer')) {
126
- oldPointers = findPointers(this.getPresenceId(sessionId), this.decorationSet);
127
- } else {
128
- oldPointers = _findPointers(sessionId, this.decorationSet);
129
- }
119
+ var oldPointers = findPointers(this.getPresenceId(sessionId), this.decorationSet);
130
120
  if (oldPointers) {
131
121
  remove = remove.concat(oldPointers);
132
122
  }
@@ -150,7 +140,7 @@ export var PluginState = /*#__PURE__*/function () {
150
140
  } catch (err) {
151
141
  this.onError(err);
152
142
  }
153
- add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), fg('confluence_team_presence_scroll_to_pointer') ? hasExistingNudge(sessionId, this.nudgeAnimations) : false));
143
+ add = add.concat(createTelepointers(from, to, sessionId, isSelection, this.getInitial(sessionId), this.getPresenceId(sessionId), this.getFullName(sessionId), hasExistingNudge(sessionId, this.nudgeAnimations)));
154
144
  }
155
145
  }
156
146
  if (tr.docChanged) {
@@ -169,7 +159,7 @@ export var PluginState = /*#__PURE__*/function () {
169
159
  size = _ref.slice.content.size,
170
160
  _from = _ref.from;
171
161
  var pos = getValidPos(tr, size ? Math.min(_from + size, tr.doc.nodeSize - 3) : Math.max(_from, 1));
172
- add = add.concat(createTelepointers(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId), fg('confluence_team_presence_scroll_to_pointer') ? hasExistingNudge(_sessionId, _this.nudgeAnimations) : false));
162
+ add = add.concat(createTelepointers(pos, pos, _sessionId, false, _this.getInitial(_sessionId), presenceId, _this.getFullName(_sessionId), hasExistingNudge(_sessionId, _this.nudgeAnimations)));
173
163
  }
174
164
  }
175
165
  }
@@ -177,7 +167,7 @@ export var PluginState = /*#__PURE__*/function () {
177
167
  } catch (err) {
178
168
  this.onError(err);
179
169
  }
180
- if (!fg('platform_editor_ai_in_document_streaming')) {
170
+ if (!editorExperiment('platform_editor_ai_aifc', true)) {
181
171
  // Remove any selection decoration within the change range,
182
172
  // takes care of the issue when after pasting we end up with a dead selection
183
173
  tr.steps.filter(isReplaceStep).forEach(function (s) {
@@ -223,7 +213,7 @@ export var PluginState = /*#__PURE__*/function () {
223
213
  }
224
214
  }
225
215
  });
226
- if (nudgeTelepointerData && fg('confluence_team_presence_scroll_to_pointer')) {
216
+ if (nudgeTelepointerData) {
227
217
  var nudgeSessionId = nudgeTelepointerData === null || nudgeTelepointerData === void 0 ? void 0 : nudgeTelepointerData.sessionId;
228
218
 
229
219
  // Ignored via go/ees005
@@ -258,11 +248,7 @@ export var PluginState = /*#__PURE__*/function () {
258
248
  }
259
249
  }
260
250
  }
261
- if (fg('confluence_team_presence_scroll_to_pointer')) {
262
- var _nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised, this.onError, this.nudgeAnimations);
263
- return PluginState.eq(_nextState, this) ? this : _nextState;
264
- }
265
- var nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised);
251
+ var nextState = new PluginState(this.decorationSet, participants, sid, collabInitialised, this.onError, this.nudgeAnimations);
266
252
  return PluginState.eq(nextState, this) ? this : nextState;
267
253
  }
268
254
  }], [{
@@ -8,12 +8,6 @@ import { Transaction, Selection, TextSelection } from '@atlaskit/editor-prosemir
8
8
  import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
9
9
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
10
10
  import { getParticipantColor } from '@atlaskit/editor-shared-styles';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
- export var _findPointers = function _findPointers(id, decorations) {
13
- return decorations.find().reduce(function (arr, deco) {
14
- return deco.spec.pointer.sessionId === id ? arr.concat(deco) : arr;
15
- }, []);
16
- };
17
11
  export var findPointers = function findPointers(id, decorations) {
18
12
  return decorations.find().reduce(function (arr, deco) {
19
13
  return deco.spec.pointer.presenceId === id ? arr.concat(deco) : arr;
@@ -60,29 +54,28 @@ export var createTelepointers = function createTelepointers(from, to, sessionId,
60
54
  cursor.setAttribute('data-initial', initial);
61
55
  cursor.setAttribute('aria-label', "".concat(fullName, " cursor position"));
62
56
  cursor.setAttribute('role', 'button');
63
- if (fg('confluence_team_presence_scroll_to_pointer')) {
64
- cursor.setAttribute(TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
65
- // If there is an ongoing expand animation, we'll keep the telepointer expanded
66
- // until the keyframe animation is complete. Please note that this will restart the anim timer
67
- // from 0 everytime it's re-added.
68
- if (isNudged) {
69
- cursor.classList.add(TELEPOINTER_PULSE_DURING_TR_CLASS);
70
- }
71
- var fullNameEl = document.createElement('span');
72
- fullNameEl.textContent = fullName;
73
- fullNameEl.className = 'telepointer-fullname';
74
- fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
75
- fullNameEl.style.color = avatarColor.textColor;
76
- fullNameEl.setAttribute('aria-hidden', 'true');
77
- cursor.appendChild(fullNameEl);
78
- var initialEl = document.createElement('span');
79
- initialEl.textContent = initial;
80
- initialEl.className = 'telepointer-initial';
81
- initialEl.style.backgroundColor = avatarColor.backgroundColor;
82
- initialEl.style.color = avatarColor.textColor;
83
- initialEl.setAttribute('aria-hidden', 'true');
84
- cursor.appendChild(initialEl);
57
+ cursor.setAttribute(TELEPOINTER_DATA_SESSION_ID_ATTR, sessionId);
58
+
59
+ // If there is an ongoing expand animation, we'll keep the telepointer expanded
60
+ // until the keyframe animation is complete. Please note that this will restart the anim timer
61
+ // from 0 everytime it's re-added.
62
+ if (isNudged) {
63
+ cursor.classList.add(TELEPOINTER_PULSE_DURING_TR_CLASS);
85
64
  }
65
+ var fullNameEl = document.createElement('span');
66
+ fullNameEl.textContent = fullName;
67
+ fullNameEl.className = 'telepointer-fullname';
68
+ fullNameEl.style.backgroundColor = avatarColor.backgroundColor;
69
+ fullNameEl.style.color = avatarColor.textColor;
70
+ fullNameEl.setAttribute('aria-hidden', 'true');
71
+ cursor.appendChild(fullNameEl);
72
+ var initialEl = document.createElement('span');
73
+ initialEl.textContent = initial;
74
+ initialEl.className = 'telepointer-initial';
75
+ initialEl.style.backgroundColor = avatarColor.backgroundColor;
76
+ initialEl.style.color = avatarColor.textColor;
77
+ initialEl.setAttribute('aria-hidden', 'true');
78
+ cursor.appendChild(initialEl);
86
79
  return decorations.concat(Decoration.widget(to, spaceJoinerAfter, {
87
80
  pointer: {
88
81
  sessionId: sessionId,
@@ -5,7 +5,6 @@ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
5
5
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
6
6
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
8
- export declare const _findPointers: (id: string, decorations: DecorationSet) => Decoration[];
9
8
  export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[];
10
9
  export declare function getAvatarColor(str: string): {
11
10
  index: number;
@@ -5,7 +5,6 @@ import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
5
5
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
6
6
  import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
8
- export declare const _findPointers: (id: string, decorations: DecorationSet) => Decoration[];
9
8
  export declare const findPointers: (id: string, decorations: DecorationSet) => Decoration[];
10
9
  export declare function getAvatarColor(str: string): {
11
10
  index: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "4.1.4",
3
+ "version": "4.1.6",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
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": "^10.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^11.1.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "memoize-one": "^6.0.0"
48
48
  },
@@ -103,12 +103,6 @@
103
103
  }
104
104
  },
105
105
  "platform-feature-flags": {
106
- "confluence_team_presence_scroll_to_pointer": {
107
- "type": "boolean"
108
- },
109
- "platform_editor_ai_in_document_streaming": {
110
- "type": "boolean"
111
- },
112
106
  "platform_enable_ncs_step_metrics": {
113
107
  "type": "boolean"
114
108
  }