@atlaskit/editor-plugin-find-replace 14.0.0 → 14.0.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,19 @@
1
1
  # @atlaskit/editor-plugin-find-replace
2
2
 
3
+ ## 14.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`42931028bd815`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/42931028bd815) -
8
+ [FFCLEANUP-138148] clean up experiment `platform_editor_find_and_replace_improvements`
9
+ - Updated dependencies
10
+
11
+ ## 14.0.1
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 14.0.0
4
18
 
5
19
  ### Patch Changes
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.toggleMatchCase = exports.replaceAll = exports.replace = exports.removeDecorations = exports.findPrevious = exports.findNext = exports.find = exports.cancelSearch = exports.blur = exports.addDecorations = exports.activate = void 0;
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _view = require("@atlaskit/editor-prosemirror/view");
10
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
11
10
  var _actions = require("./actions");
12
11
  var _pluginFactory = require("./plugin-factory");
13
12
  var _utils = require("./utils");
@@ -34,7 +33,7 @@ var activate = exports.activate = function activate() {
34
33
  getIntl: getIntl,
35
34
  api: api
36
35
  });
37
- index = (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? (0, _utils.findClosestMatch)(selection.from, matches) : (0, _utils.findSearchIndex)(selection.from, matches);
36
+ index = (0, _utils.findClosestMatch)(selection.from, matches);
38
37
  }
39
38
  return {
40
39
  type: _actions.FindReplaceActionTypes.ACTIVATE,
@@ -58,7 +57,7 @@ var find = exports.find = function find(editorView, containerElement, keyword) {
58
57
  getIntl: getIntl,
59
58
  api: api
60
59
  }) : [];
61
- var index = (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? (0, _utils.findClosestMatch)(selection.from, matches) : (0, _utils.findSearchIndex)(selection.from, matches);
60
+ var index = (0, _utils.findClosestMatch)(selection.from, matches);
62
61
 
63
62
  // we can't just apply all the decorations to highlight the search results at once
64
63
  // as if there are a lot ProseMirror cries :'(
@@ -88,7 +87,7 @@ var find = exports.find = function find(editorView, containerElement, keyword) {
88
87
  }) : [];
89
88
  if (matches.length > 0) {
90
89
  var _api$expand;
91
- var index = (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? (0, _utils.findClosestMatch)(selection.from, matches) : (0, _utils.findSearchIndex)(selection.from, matches);
90
+ var index = (0, _utils.findClosestMatch)(selection.from, matches);
92
91
  var newSelection = (0, _utils.getSelectionForMatch)(tr.selection, tr.doc, index, matches);
93
92
  api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
94
93
  tr: tr
@@ -195,7 +194,7 @@ var replace = exports.replace = function replace(replaceText) {
195
194
  index = _getPluginState6.index,
196
195
  findText = _getPluginState6.findText;
197
196
  if (matches[index]) {
198
- if (!matches[index].canReplace && (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
197
+ if (!matches[index].canReplace) {
199
198
  return tr;
200
199
  }
201
200
  var _matches$index = matches[index],
@@ -217,7 +216,7 @@ var replaceAll = exports.replaceAll = function replaceAll(replaceText) {
217
216
  }, function (tr, state) {
218
217
  var pluginState = (0, _pluginFactory.getPluginState)(state);
219
218
  pluginState.matches.forEach(function (match) {
220
- if (!match.canReplace && (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
219
+ if (!match.canReplace) {
221
220
  return tr;
222
221
  }
223
222
  tr.insertText(replaceText, tr.mapping.map(match.start), tr.mapping.map(match.end));
@@ -9,7 +9,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
10
  var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _view = require("@atlaskit/editor-prosemirror/view");
12
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
12
  var _main = require("./main");
14
13
  var _pluginKey = require("./plugin-key");
15
14
  var _reducer = _interopRequireDefault(require("./reducer"));
@@ -100,7 +99,7 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
100
99
  });
101
100
  }
102
101
  if (newIndex === undefined || newIndex === -1) {
103
- newIndex = (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? (0, _utils2.findClosestMatch)(tr.selection.from, newMatches) : (0, _utils2.findSearchIndex)(tr.selection.from, newMatches);
102
+ newIndex = (0, _utils2.findClosestMatch)(tr.selection.from, newMatches);
104
103
  }
105
104
  var newSelectedMatch = newMatches[newIndex];
106
105
  decorationSet = (0, _utils2.removeMatchesFromSet)(decorationSet, [selectedMatch, newSelectedMatch], tr.doc);
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
10
9
  var _actions = require("./actions");
11
10
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
11
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -47,10 +46,10 @@ var reducer = function reducer(getInitialState) {
47
46
  case _actions.FindReplaceActionTypes.CANCEL:
48
47
  var getIntl = state.getIntl,
49
48
  api = state.api;
50
- return (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? _objectSpread(_objectSpread({}, getInitialState()), {}, {
49
+ return _objectSpread(_objectSpread({}, getInitialState()), {}, {
51
50
  getIntl: getIntl,
52
51
  api: api
53
- }) : getInitialState();
52
+ });
54
53
  case _actions.FindReplaceActionTypes.BLUR:
55
54
  return _objectSpread(_objectSpread({}, state), {}, {
56
55
  shouldFocus: false
@@ -9,7 +9,6 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
12
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
12
  var _pluginFactory = require("../plugin-factory");
14
13
  var _index = require("./index");
15
14
  // max number of decorations to apply at once
@@ -249,7 +248,7 @@ var BatchDecorations = /*#__PURE__*/function () {
249
248
  return {
250
249
  viewportStartPos: viewportStartPos,
251
250
  viewportEndPos: viewportEndPos,
252
- startPos: (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? 0 : 1,
251
+ startPos: 0,
253
252
  endPos: editorView.state.doc.nodeSize
254
253
  };
255
254
  }
@@ -260,11 +259,7 @@ var BatchDecorations = /*#__PURE__*/function () {
260
259
  top: y,
261
260
  left: x
262
261
  });
263
- if ((0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
264
- return startPos ? startPos.pos : 0;
265
- } else {
266
- return startPos ? startPos.pos : 1;
267
- }
262
+ return startPos ? startPos.pos : 0;
268
263
  }
269
264
  }, {
270
265
  key: "getEndPos",
@@ -20,7 +20,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
20
20
  var _view = require("@atlaskit/editor-prosemirror/view");
21
21
  var _resource = require("@atlaskit/mention/resource");
22
22
  var _types = require("@atlaskit/mention/types");
23
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
24
23
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
25
24
  var _getGlobalTheme2 = require("@atlaskit/tokens/get-global-theme");
26
25
  var _styles = require("../../ui/styles");
@@ -93,32 +92,22 @@ var createDecoration = exports.createDecoration = function createDecoration(matc
93
92
  var start = match.start,
94
93
  end = match.end,
95
94
  nodeType = match.nodeType;
96
- if ((0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
97
- var _getGlobalTheme = (0, _getGlobalTheme2.getGlobalTheme)(),
98
- colorMode = _getGlobalTheme.colorMode;
99
- if (isElement(nodeType)) {
100
- var className = (0, _classnames4.default)(_styles.blockSearchMatchClass, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _styles.selectedBlockSearchMatchClass, isSelected), _styles.darkModeSearchMatchClass, colorMode === 'dark'));
101
- return _view.Decoration.node(start, end, {
102
- class: className
103
- });
104
- } else if (isExpandTitle(match)) {
105
- var _className = (0, _classnames4.default)(_styles.searchMatchExpandTitleClass, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _styles.selectedSearchMatchClass, isSelected), _styles.darkModeSearchMatchClass, colorMode === 'dark'));
106
- return _view.Decoration.node(start, end, {
107
- class: _className
108
- });
109
- } else {
110
- var _className2 = (0, _classnames4.default)(_styles.searchMatchTextClass, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _styles.selectedSearchMatchClass, isSelected), _styles.darkModeSearchMatchClass, colorMode === 'dark'));
111
- return _view.Decoration.inline(start, end, {
112
- class: _className2
113
- });
114
- }
95
+ var _getGlobalTheme = (0, _getGlobalTheme2.getGlobalTheme)(),
96
+ colorMode = _getGlobalTheme.colorMode;
97
+ if (isElement(nodeType)) {
98
+ var className = (0, _classnames4.default)(_styles.blockSearchMatchClass, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _styles.selectedBlockSearchMatchClass, isSelected), _styles.darkModeSearchMatchClass, colorMode === 'dark'));
99
+ return _view.Decoration.node(start, end, {
100
+ class: className
101
+ });
102
+ } else if (isExpandTitle(match)) {
103
+ var _className = (0, _classnames4.default)(_styles.searchMatchExpandTitleClass, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _styles.selectedSearchMatchClass, isSelected), _styles.darkModeSearchMatchClass, colorMode === 'dark'));
104
+ return _view.Decoration.node(start, end, {
105
+ class: _className
106
+ });
115
107
  } else {
116
- var _className3 = _styles.searchMatchClass;
117
- if (isSelected) {
118
- _className3 += " ".concat(_styles.selectedSearchMatchClass);
119
- }
108
+ var _className2 = (0, _classnames4.default)(_styles.searchMatchTextClass, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _styles.selectedSearchMatchClass, isSelected), _styles.darkModeSearchMatchClass, colorMode === 'dark'));
120
109
  return _view.Decoration.inline(start, end, {
121
- class: _className3
110
+ class: _className2
122
111
  });
123
112
  }
124
113
  };
@@ -152,8 +141,8 @@ function findMatches(_ref2) {
152
141
  matches.push({
153
142
  start: pos + index,
154
143
  end: pos + end,
155
- canReplace: (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? true : undefined,
156
- nodeType: (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? 'text' : undefined
144
+ canReplace: true,
145
+ nodeType: 'text'
157
146
  });
158
147
  index = text.indexOf(searchText, end);
159
148
  }
@@ -221,83 +210,81 @@ function findMatches(_ref2) {
221
210
  } else {
222
211
  collectTextMatch(textGrouping);
223
212
  textGrouping = null;
224
- if ((0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
225
- switch (node.type.name) {
226
- case 'status':
227
- collectNodeMatch({
228
- text: node.attrs.text,
229
- pos: pos
230
- }, node);
231
- break;
232
- case 'date':
233
- collectNodeMatch({
234
- text: (0, _utils.timestampToString)(node.attrs.timestamp, getIntl ? getIntl() : null),
235
- pos: pos
236
- }, node);
237
- break;
238
- case 'expand':
239
- case 'nestedExpand':
240
- collectNodeMatch({
241
- text: node.attrs.title,
242
- pos: pos
243
- }, node);
244
- break;
245
- case 'mention':
246
- var text;
247
- if (node.attrs.text) {
248
- text = node.attrs.text;
249
- } else {
250
- var _api$mention;
251
- // the text may be sanitised from the node for privacy reasons
252
- // so we need to use the mentionProvider to resolve it
253
- var mentionProvider = api === null || api === void 0 || (_api$mention = api.mention) === null || _api$mention === void 0 || (_api$mention = _api$mention.sharedState.currentState()) === null || _api$mention === void 0 ? void 0 : _api$mention.mentionProvider;
254
- if ((0, _resource.isResolvingMentionProvider)(mentionProvider)) {
255
- var nameDetail = mentionProvider.resolveMentionName(node.attrs.id);
256
- if ((0, _types.isPromise)(nameDetail)) {
257
- text = '@...';
213
+ switch (node.type.name) {
214
+ case 'status':
215
+ collectNodeMatch({
216
+ text: node.attrs.text,
217
+ pos: pos
218
+ }, node);
219
+ break;
220
+ case 'date':
221
+ collectNodeMatch({
222
+ text: (0, _utils.timestampToString)(node.attrs.timestamp, getIntl ? getIntl() : null),
223
+ pos: pos
224
+ }, node);
225
+ break;
226
+ case 'expand':
227
+ case 'nestedExpand':
228
+ collectNodeMatch({
229
+ text: node.attrs.title,
230
+ pos: pos
231
+ }, node);
232
+ break;
233
+ case 'mention':
234
+ var text;
235
+ if (node.attrs.text) {
236
+ text = node.attrs.text;
237
+ } else {
238
+ var _api$mention;
239
+ // the text may be sanitised from the node for privacy reasons
240
+ // so we need to use the mentionProvider to resolve it
241
+ var mentionProvider = api === null || api === void 0 || (_api$mention = api.mention) === null || _api$mention === void 0 || (_api$mention = _api$mention.sharedState.currentState()) === null || _api$mention === void 0 ? void 0 : _api$mention.mentionProvider;
242
+ if ((0, _resource.isResolvingMentionProvider)(mentionProvider)) {
243
+ var nameDetail = mentionProvider.resolveMentionName(node.attrs.id);
244
+ if ((0, _types.isPromise)(nameDetail)) {
245
+ text = '@...';
246
+ } else {
247
+ if (nameDetail.status === _types.MentionNameStatus.OK) {
248
+ text = "@".concat(nameDetail.name || '');
258
249
  } else {
259
- if (nameDetail.status === _types.MentionNameStatus.OK) {
260
- text = "@".concat(nameDetail.name || '');
261
- } else {
262
- text = '@_|unknown|_';
263
- }
250
+ text = '@_|unknown|_';
264
251
  }
265
252
  }
266
253
  }
267
- if (text) {
268
- collectNodeMatch({
269
- text: text,
270
- pos: pos
271
- }, node);
272
- }
273
- break;
274
- case 'inlineCard':
275
- case 'blockCard':
276
- case 'embedCard':
277
- collectCardTitleMatch(node, pos);
278
- break;
279
- case 'syncBlock':
280
- {
281
- if ((0, _experiments.editorExperiment)('platform_synced_block', true)) {
282
- var _api$syncedBlock, _instance$data;
283
- var syncBlockStore = api === null || api === void 0 || (_api$syncedBlock = api.syncedBlock) === null || _api$syncedBlock === void 0 || (_api$syncedBlock = _api$syncedBlock.sharedState.currentState()) === null || _api$syncedBlock === void 0 ? void 0 : _api$syncedBlock.syncBlockStore;
284
- var instance = syncBlockStore === null || syncBlockStore === void 0 ? void 0 : syncBlockStore.referenceManager.getFromCache(node.attrs.resourceId);
285
- var adfContent = instance === null || instance === void 0 || (_instance$data = instance.data) === null || _instance$data === void 0 ? void 0 : _instance$data.content;
286
- if (adfContent && adfContent.length > 0) {
287
- var _text = extractTextFromADFContent(adfContent);
288
- if (_text) {
289
- collectNodeMatch({
290
- text: _text,
291
- pos: pos
292
- }, node);
293
- }
254
+ }
255
+ if (text) {
256
+ collectNodeMatch({
257
+ text: text,
258
+ pos: pos
259
+ }, node);
260
+ }
261
+ break;
262
+ case 'inlineCard':
263
+ case 'blockCard':
264
+ case 'embedCard':
265
+ collectCardTitleMatch(node, pos);
266
+ break;
267
+ case 'syncBlock':
268
+ {
269
+ if ((0, _experiments.editorExperiment)('platform_synced_block', true)) {
270
+ var _api$syncedBlock, _instance$data;
271
+ var syncBlockStore = api === null || api === void 0 || (_api$syncedBlock = api.syncedBlock) === null || _api$syncedBlock === void 0 || (_api$syncedBlock = _api$syncedBlock.sharedState.currentState()) === null || _api$syncedBlock === void 0 ? void 0 : _api$syncedBlock.syncBlockStore;
272
+ var instance = syncBlockStore === null || syncBlockStore === void 0 ? void 0 : syncBlockStore.referenceManager.getFromCache(node.attrs.resourceId);
273
+ var adfContent = instance === null || instance === void 0 || (_instance$data = instance.data) === null || _instance$data === void 0 ? void 0 : _instance$data.content;
274
+ if (adfContent && adfContent.length > 0) {
275
+ var _text = extractTextFromADFContent(adfContent);
276
+ if (_text) {
277
+ collectNodeMatch({
278
+ text: _text,
279
+ pos: pos
280
+ }, node);
294
281
  }
295
282
  }
296
- break;
297
283
  }
298
- default:
299
284
  break;
300
- }
285
+ }
286
+ default:
287
+ break;
301
288
  }
302
289
  }
303
290
  });
@@ -20,7 +20,6 @@ var _analytics = require("@atlaskit/editor-common/analytics");
20
20
  var _messages = require("@atlaskit/editor-common/messages");
21
21
  var _form = require("@atlaskit/form");
22
22
  var _textLetterCase = _interopRequireDefault(require("@atlaskit/icon-lab/core/text-letter-case"));
23
- var _textStyle = _interopRequireDefault(require("@atlaskit/icon/core/text-style"));
24
23
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
25
24
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
26
25
  var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
@@ -142,11 +141,9 @@ var Find = /*#__PURE__*/function (_React$Component) {
142
141
  }
143
142
  });
144
143
  (0, _defineProperty2.default)(_this, "matchCaseIconEle", function (iconProps) {
145
- return (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? (0, _react2.jsx)(_textLetterCase.default, {
144
+ return (0, _react2.jsx)(_textLetterCase.default, {
146
145
  label: iconProps.label,
147
146
  size: "small"
148
- }) : (0, _react2.jsx)(_textStyle.default, {
149
- label: _this.matchCase
150
147
  });
151
148
  });
152
149
  var formatMessage = props.intl.formatMessage;
@@ -14,7 +14,6 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _react2 = require("@emotion/react");
16
16
  var _messages = require("@atlaskit/editor-common/messages");
17
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
18
17
  var _Find = _interopRequireDefault(require("./Find"));
19
18
  var _Replace = _interopRequireDefault(require("./Replace"));
20
19
  var _uiStyles = require("./ui-styles");
@@ -110,7 +109,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
110
109
  css: _uiStyles.ruleStyles,
111
110
  id: "replace-hr-element"
112
111
  }), (0, _react2.jsx)(_Replace.default, {
113
- canReplace: (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? !!isReplaceable : count.total > 0,
112
+ canReplace: !!isReplaceable,
114
113
  replaceText: replaceText,
115
114
  onReplace: onReplace,
116
115
  onReplaceAll: onReplaceAll,
@@ -9,7 +9,6 @@ exports.default = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _analytics = require("@atlaskit/editor-common/analytics");
12
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
13
12
  var _commands = require("../pm-plugins/commands");
14
13
  var _commandsWithAnalytics = require("../pm-plugins/commands-with-analytics");
15
14
  var _FindReplaceDropdown = _interopRequireDefault(require("./FindReplaceDropdown"));
@@ -155,12 +154,12 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
155
154
  findText: findText,
156
155
  index: index,
157
156
  numMatches: matches.length,
158
- isReplaceable: (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? (_matches$index = matches[index]) === null || _matches$index === void 0 ? void 0 : _matches$index.canReplace : undefined,
159
- numReplaceable: (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ?
157
+ isReplaceable: (_matches$index = matches[index]) === null || _matches$index === void 0 ? void 0 : _matches$index.canReplace,
158
+ numReplaceable:
160
159
  // eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
161
160
  matches.filter(function (match) {
162
161
  return match.canReplace === true;
163
- }).length : undefined,
162
+ }).length,
164
163
  replaceText: replaceText,
165
164
  shouldFocus: shouldFocus,
166
165
  popupsBoundariesElement: popupsBoundariesElement,
@@ -17,7 +17,6 @@ var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-d
17
17
  var _chevronUp = _interopRequireDefault(require("@atlaskit/icon/core/chevron-up"));
18
18
  var _primitives = require("@atlaskit/primitives");
19
19
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
20
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
21
20
  var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
22
21
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
23
22
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
@@ -34,13 +33,10 @@ var actionButtonContainerStyles = (0, _primitives.xcss)({
34
33
  paddingTop: 'space.200'
35
34
  });
36
35
  var actionButtonParentInlineStyles = (0, _primitives.xcss)({
37
- justifyContent: 'space-between',
38
- flexDirection: 'row-reverse'
39
- });
40
- var actionButtonParentInlineStylesNew = (0, _primitives.xcss)({
41
36
  justifyContent: 'space-between',
42
37
  flexDirection: 'row-reverse',
43
- flexWrap: 'wrap'
38
+ flexWrap: 'wrap',
39
+ gap: 'space.075'
44
40
  });
45
41
  var actionButtonInlineStyles = (0, _primitives.xcss)({
46
42
  gap: 'space.075'
@@ -156,7 +152,7 @@ var Replace = function Replace(_ref) {
156
152
  replaceText: replaceText
157
153
  });
158
154
  setIsHelperMessageVisible(true);
159
- if (count.totalReplaceable && (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
155
+ if (count.totalReplaceable) {
160
156
  triggerSuccessReplacementMessageUpdate(count.totalReplaceable);
161
157
  setReplaceCount(count.totalReplaceable);
162
158
  } else {
@@ -227,7 +223,7 @@ var Replace = function Replace(_ref) {
227
223
  resultsReplace.replace(SPACE_REGEX, "\xA0") : resultsReplace)), /*#__PURE__*/_react.default.createElement(_primitives.Box, {
228
224
  xcss: actionButtonContainerStyles
229
225
  }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
230
- xcss: (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? [actionButtonInlineStyles, actionButtonParentInlineStylesNew] : [actionButtonInlineStyles, actionButtonParentInlineStyles]
226
+ xcss: actionButtonParentInlineStyles
231
227
  }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
232
228
  xcss: actionButtonInlineStyles
233
229
  }, /*#__PURE__*/_react.default.createElement(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
@@ -268,18 +264,14 @@ var Replace = function Replace(_ref) {
268
264
  testId: replaceAll,
269
265
  id: "replaceAll-button",
270
266
  onClick: handleReplaceAllClick,
271
- isDisabled: (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? count.totalReplaceable === 0 : !canReplace
272
- }, replaceAll)), (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
267
+ isDisabled: count.totalReplaceable === 0
268
+ }, replaceAll)), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
273
269
  xcss: closeButtonInlineStyles
274
270
  }, /*#__PURE__*/_react.default.createElement(_new.default, {
275
271
  appearance: "subtle",
276
272
  testId: closeFindReplaceDialog,
277
273
  onClick: clearSearch
278
- }, closeFindReplaceDialog)) : /*#__PURE__*/_react.default.createElement(_new.default, {
279
- appearance: "subtle",
280
- testId: closeFindReplaceDialog,
281
- onClick: clearSearch
282
- }, closeFindReplaceDialog))));
274
+ }, closeFindReplaceDialog)))));
283
275
  };
284
276
 
285
277
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -1,6 +1,5 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
3
  import { FindReplaceActionTypes } from './actions';
5
4
  import { createCommand, getPluginState } from './plugin-factory';
6
5
  import { createDecoration, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, getSelectedText, getSelectionForMatch, nextIndex, prevIndex, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
@@ -29,7 +28,7 @@ export const activate = () => createCommand(state => {
29
28
  getIntl,
30
29
  api
31
30
  });
32
- index = expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? findClosestMatch(selection.from, matches) : findSearchIndex(selection.from, matches);
31
+ index = findClosestMatch(selection.from, matches);
33
32
  }
34
33
  return {
35
34
  type: FindReplaceActionTypes.ACTIVATE,
@@ -54,7 +53,7 @@ export const find = (editorView, containerElement, keyword) => withScrollIntoVie
54
53
  getIntl,
55
54
  api
56
55
  }) : [];
57
- const index = expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? findClosestMatch(selection.from, matches) : findSearchIndex(selection.from, matches);
56
+ const index = findClosestMatch(selection.from, matches);
58
57
 
59
58
  // we can't just apply all the decorations to highlight the search results at once
60
59
  // as if there are a lot ProseMirror cries :'(
@@ -83,7 +82,7 @@ export const find = (editorView, containerElement, keyword) => withScrollIntoVie
83
82
  }) : [];
84
83
  if (matches.length > 0) {
85
84
  var _api$expand;
86
- const index = expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? findClosestMatch(selection.from, matches) : findSearchIndex(selection.from, matches);
85
+ const index = findClosestMatch(selection.from, matches);
87
86
  const newSelection = getSelectionForMatch(tr.selection, tr.doc, index, matches);
88
87
  api === null || api === void 0 ? void 0 : (_api$expand = api.expand) === null || _api$expand === void 0 ? void 0 : _api$expand.commands.toggleExpandWithMatch(newSelection)({
89
88
  tr
@@ -191,7 +190,7 @@ export const replace = replaceText => withScrollIntoView(createCommand(state =>
191
190
  findText
192
191
  } = getPluginState(state);
193
192
  if (matches[index]) {
194
- if (!matches[index].canReplace && expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
193
+ if (!matches[index].canReplace) {
195
194
  return tr;
196
195
  }
197
196
  const {
@@ -212,7 +211,7 @@ export const replaceAll = replaceText => createCommand({
212
211
  }, (tr, state) => {
213
212
  const pluginState = getPluginState(state);
214
213
  pluginState.matches.forEach(match => {
215
- if (!match.canReplace && expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
214
+ if (!match.canReplace) {
216
215
  return tr;
217
216
  }
218
217
  tr.insertText(replaceText, tr.mapping.map(match.start), tr.mapping.map(match.end));
@@ -1,10 +1,9 @@
1
1
  import { pluginFactory, stepHasSlice } from '@atlaskit/editor-common/utils';
2
2
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
3
  import { initialState } from './main';
5
4
  import { findReplacePluginKey } from './plugin-key';
6
5
  import reducer from './reducer';
7
- import { createDecorations, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, findUniqueItemsIn, getSelectionForMatch, isMatchAffectedByStep, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
6
+ import { createDecorations, findClosestMatch, findDecorationFromMatch, findMatches, findUniqueItemsIn, getSelectionForMatch, isMatchAffectedByStep, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
8
7
  const handleDocChanged = (tr, pluginState) => {
9
8
  var _api$expand;
10
9
  const {
@@ -81,7 +80,7 @@ const handleDocChanged = (tr, pluginState) => {
81
80
  newIndex = newMatches.findIndex(match => match.start === selectedMatch.start);
82
81
  }
83
82
  if (newIndex === undefined || newIndex === -1) {
84
- newIndex = expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? findClosestMatch(tr.selection.from, newMatches) : findSearchIndex(tr.selection.from, newMatches);
83
+ newIndex = findClosestMatch(tr.selection.from, newMatches);
85
84
  }
86
85
  const newSelectedMatch = newMatches[newIndex];
87
86
  decorationSet = removeMatchesFromSet(decorationSet, [selectedMatch, newSelectedMatch], tr.doc);
@@ -1,4 +1,3 @@
1
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
1
  import { FindReplaceActionTypes } from './actions';
3
2
  const reducer = getInitialState => (state, action) => {
4
3
  switch (action.type) {
@@ -43,11 +42,11 @@ const reducer = getInitialState => (state, action) => {
43
42
  getIntl,
44
43
  api
45
44
  } = state;
46
- return expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? {
45
+ return {
47
46
  ...getInitialState(),
48
47
  getIntl,
49
48
  api
50
- } : getInitialState();
49
+ };
51
50
  case FindReplaceActionTypes.BLUR:
52
51
  return {
53
52
  ...state,
@@ -1,4 +1,3 @@
1
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
1
  import { getPluginState } from '../plugin-factory';
3
2
  import { createDecorations, findDecorationFromMatch } from './index';
4
3
 
@@ -135,7 +134,7 @@ class BatchDecorations {
135
134
  return {
136
135
  viewportStartPos,
137
136
  viewportEndPos,
138
- startPos: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? 0 : 1,
137
+ startPos: 0,
139
138
  endPos: editorView.state.doc.nodeSize
140
139
  };
141
140
  }
@@ -144,11 +143,7 @@ class BatchDecorations {
144
143
  top: y,
145
144
  left: x
146
145
  });
147
- if (expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
148
- return startPos ? startPos.pos : 0;
149
- } else {
150
- return startPos ? startPos.pos : 1;
151
- }
146
+ return startPos ? startPos.pos : 0;
152
147
  }
153
148
  getEndPos(editorView, y, x) {
154
149
  const maxPos = editorView.state.doc.nodeSize;