@atlaskit/editor-plugin-find-replace 14.0.1 → 14.0.3

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.
@@ -8,10 +8,9 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
8
8
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
9
  import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
10
10
  import { isPromise, MentionNameStatus } from '@atlaskit/mention/types';
11
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
11
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
12
  import { getGlobalTheme } from '@atlaskit/tokens/get-global-theme';
14
- import { searchMatchClass, selectedSearchMatchClass, blockSearchMatchClass, darkModeSearchMatchClass, selectedBlockSearchMatchClass, searchMatchExpandTitleClass, searchMatchTextClass } from '../../ui/styles';
13
+ import { selectedSearchMatchClass, blockSearchMatchClass, darkModeSearchMatchClass, selectedBlockSearchMatchClass, searchMatchExpandTitleClass, searchMatchTextClass } from '../../ui/styles';
15
14
 
16
15
  /**
17
16
  * Recursively extracts all text content from an ADF entity tree.
@@ -79,32 +78,22 @@ export var createDecoration = function createDecoration(match, isSelected) {
79
78
  var start = match.start,
80
79
  end = match.end,
81
80
  nodeType = match.nodeType;
82
- if (expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
83
- var _getGlobalTheme = getGlobalTheme(),
84
- colorMode = _getGlobalTheme.colorMode;
85
- if (isElement(nodeType)) {
86
- var className = classnames(blockSearchMatchClass, _defineProperty(_defineProperty({}, selectedBlockSearchMatchClass, isSelected), darkModeSearchMatchClass, colorMode === 'dark'));
87
- return Decoration.node(start, end, {
88
- class: className
89
- });
90
- } else if (isExpandTitle(match)) {
91
- var _className = classnames(searchMatchExpandTitleClass, _defineProperty(_defineProperty({}, selectedSearchMatchClass, isSelected), darkModeSearchMatchClass, colorMode === 'dark'));
92
- return Decoration.node(start, end, {
93
- class: _className
94
- });
95
- } else {
96
- var _className2 = classnames(searchMatchTextClass, _defineProperty(_defineProperty({}, selectedSearchMatchClass, isSelected), darkModeSearchMatchClass, colorMode === 'dark'));
97
- return Decoration.inline(start, end, {
98
- class: _className2
99
- });
100
- }
81
+ var _getGlobalTheme = getGlobalTheme(),
82
+ colorMode = _getGlobalTheme.colorMode;
83
+ if (isElement(nodeType)) {
84
+ var className = classnames(blockSearchMatchClass, _defineProperty(_defineProperty({}, selectedBlockSearchMatchClass, isSelected), darkModeSearchMatchClass, colorMode === 'dark'));
85
+ return Decoration.node(start, end, {
86
+ class: className
87
+ });
88
+ } else if (isExpandTitle(match)) {
89
+ var _className = classnames(searchMatchExpandTitleClass, _defineProperty(_defineProperty({}, selectedSearchMatchClass, isSelected), darkModeSearchMatchClass, colorMode === 'dark'));
90
+ return Decoration.node(start, end, {
91
+ class: _className
92
+ });
101
93
  } else {
102
- var _className3 = searchMatchClass;
103
- if (isSelected) {
104
- _className3 += " ".concat(selectedSearchMatchClass);
105
- }
94
+ var _className2 = classnames(searchMatchTextClass, _defineProperty(_defineProperty({}, selectedSearchMatchClass, isSelected), darkModeSearchMatchClass, colorMode === 'dark'));
106
95
  return Decoration.inline(start, end, {
107
- class: _className3
96
+ class: _className2
108
97
  });
109
98
  }
110
99
  };
@@ -138,8 +127,8 @@ export function findMatches(_ref2) {
138
127
  matches.push({
139
128
  start: pos + index,
140
129
  end: pos + end,
141
- canReplace: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? true : undefined,
142
- nodeType: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? 'text' : undefined
130
+ canReplace: true,
131
+ nodeType: 'text'
143
132
  });
144
133
  index = text.indexOf(searchText, end);
145
134
  }
@@ -207,83 +196,81 @@ export function findMatches(_ref2) {
207
196
  } else {
208
197
  collectTextMatch(textGrouping);
209
198
  textGrouping = null;
210
- if (expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
211
- switch (node.type.name) {
212
- case 'status':
213
- collectNodeMatch({
214
- text: node.attrs.text,
215
- pos: pos
216
- }, node);
217
- break;
218
- case 'date':
219
- collectNodeMatch({
220
- text: timestampToString(node.attrs.timestamp, getIntl ? getIntl() : null),
221
- pos: pos
222
- }, node);
223
- break;
224
- case 'expand':
225
- case 'nestedExpand':
226
- collectNodeMatch({
227
- text: node.attrs.title,
228
- pos: pos
229
- }, node);
230
- break;
231
- case 'mention':
232
- var text;
233
- if (node.attrs.text) {
234
- text = node.attrs.text;
235
- } else {
236
- var _api$mention;
237
- // the text may be sanitised from the node for privacy reasons
238
- // so we need to use the mentionProvider to resolve it
239
- 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;
240
- if (isResolvingMentionProvider(mentionProvider)) {
241
- var nameDetail = mentionProvider.resolveMentionName(node.attrs.id);
242
- if (isPromise(nameDetail)) {
243
- text = '@...';
199
+ switch (node.type.name) {
200
+ case 'status':
201
+ collectNodeMatch({
202
+ text: node.attrs.text,
203
+ pos: pos
204
+ }, node);
205
+ break;
206
+ case 'date':
207
+ collectNodeMatch({
208
+ text: timestampToString(node.attrs.timestamp, getIntl ? getIntl() : null),
209
+ pos: pos
210
+ }, node);
211
+ break;
212
+ case 'expand':
213
+ case 'nestedExpand':
214
+ collectNodeMatch({
215
+ text: node.attrs.title,
216
+ pos: pos
217
+ }, node);
218
+ break;
219
+ case 'mention':
220
+ var text;
221
+ if (node.attrs.text) {
222
+ text = node.attrs.text;
223
+ } else {
224
+ var _api$mention;
225
+ // the text may be sanitised from the node for privacy reasons
226
+ // so we need to use the mentionProvider to resolve it
227
+ 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;
228
+ if (isResolvingMentionProvider(mentionProvider)) {
229
+ var nameDetail = mentionProvider.resolveMentionName(node.attrs.id);
230
+ if (isPromise(nameDetail)) {
231
+ text = '@...';
232
+ } else {
233
+ if (nameDetail.status === MentionNameStatus.OK) {
234
+ text = "@".concat(nameDetail.name || '');
244
235
  } else {
245
- if (nameDetail.status === MentionNameStatus.OK) {
246
- text = "@".concat(nameDetail.name || '');
247
- } else {
248
- text = '@_|unknown|_';
249
- }
236
+ text = '@_|unknown|_';
250
237
  }
251
238
  }
252
239
  }
253
- if (text) {
254
- collectNodeMatch({
255
- text: text,
256
- pos: pos
257
- }, node);
258
- }
259
- break;
260
- case 'inlineCard':
261
- case 'blockCard':
262
- case 'embedCard':
263
- collectCardTitleMatch(node, pos);
264
- break;
265
- case 'syncBlock':
266
- {
267
- if (editorExperiment('platform_synced_block', true)) {
268
- var _api$syncedBlock, _instance$data;
269
- 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;
270
- var instance = syncBlockStore === null || syncBlockStore === void 0 ? void 0 : syncBlockStore.referenceManager.getFromCache(node.attrs.resourceId);
271
- var adfContent = instance === null || instance === void 0 || (_instance$data = instance.data) === null || _instance$data === void 0 ? void 0 : _instance$data.content;
272
- if (adfContent && adfContent.length > 0) {
273
- var _text = extractTextFromADFContent(adfContent);
274
- if (_text) {
275
- collectNodeMatch({
276
- text: _text,
277
- pos: pos
278
- }, node);
279
- }
240
+ }
241
+ if (text) {
242
+ collectNodeMatch({
243
+ text: text,
244
+ pos: pos
245
+ }, node);
246
+ }
247
+ break;
248
+ case 'inlineCard':
249
+ case 'blockCard':
250
+ case 'embedCard':
251
+ collectCardTitleMatch(node, pos);
252
+ break;
253
+ case 'syncBlock':
254
+ {
255
+ if (editorExperiment('platform_synced_block', true)) {
256
+ var _api$syncedBlock, _instance$data;
257
+ 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;
258
+ var instance = syncBlockStore === null || syncBlockStore === void 0 ? void 0 : syncBlockStore.referenceManager.getFromCache(node.attrs.resourceId);
259
+ var adfContent = instance === null || instance === void 0 || (_instance$data = instance.data) === null || _instance$data === void 0 ? void 0 : _instance$data.content;
260
+ if (adfContent && adfContent.length > 0) {
261
+ var _text = extractTextFromADFContent(adfContent);
262
+ if (_text) {
263
+ collectNodeMatch({
264
+ text: _text,
265
+ pos: pos
266
+ }, node);
280
267
  }
281
268
  }
282
- break;
283
269
  }
284
- default:
285
270
  break;
286
- }
271
+ }
272
+ default:
273
+ break;
287
274
  }
288
275
  }
289
276
  });
@@ -22,7 +22,6 @@ import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
22
22
  import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
23
23
  import { Label } from '@atlaskit/form';
24
24
  import TextLetterCaseIcon from '@atlaskit/icon-lab/core/text-letter-case';
25
- import MatchCaseIcon from '@atlaskit/icon/core/text-style';
26
25
  import Textfield from '@atlaskit/textfield';
27
26
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
28
27
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
@@ -139,11 +138,9 @@ var Find = /*#__PURE__*/function (_React$Component) {
139
138
  }
140
139
  });
141
140
  _defineProperty(_this, "matchCaseIconEle", function (iconProps) {
142
- return expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? jsx(TextLetterCaseIcon, {
141
+ return jsx(TextLetterCaseIcon, {
143
142
  label: iconProps.label,
144
143
  size: "small"
145
- }) : jsx(MatchCaseIcon, {
146
- label: _this.matchCase
147
144
  });
148
145
  });
149
146
  var formatMessage = props.intl.formatMessage;
@@ -17,7 +17,6 @@ import React from 'react';
17
17
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
18
18
  import { jsx } from '@emotion/react';
19
19
  import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
20
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
20
  import Find from './Find';
22
21
  import Replace from './Replace';
23
22
  import { ruleStyles, wrapperPaddingStyles, wrapperStyles } from './ui-styles';
@@ -108,7 +107,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
108
107
  css: ruleStyles,
109
108
  id: "replace-hr-element"
110
109
  }), jsx(Replace, {
111
- canReplace: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? !!isReplaceable : count.total > 0,
110
+ canReplace: !!isReplaceable,
112
111
  replaceText: replaceText,
113
112
  onReplace: onReplace,
114
113
  onReplaceAll: onReplaceAll,
@@ -1,7 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useLayoutEffect, useState } from 'react';
3
3
  import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
4
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
4
  import { blur, toggleMatchCase } from '../pm-plugins/commands';
6
5
  import { activateWithAnalytics, cancelSearchWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, findWithAnalytics, replaceAllWithAnalytics, replaceWithAnalytics } from '../pm-plugins/commands-with-analytics';
7
6
  import FindReplaceDropdown from './FindReplaceDropdown';
@@ -147,12 +146,12 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
147
146
  findText: findText,
148
147
  index: index,
149
148
  numMatches: matches.length,
150
- isReplaceable: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? (_matches$index = matches[index]) === null || _matches$index === void 0 ? void 0 : _matches$index.canReplace : undefined,
151
- numReplaceable: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ?
149
+ isReplaceable: (_matches$index = matches[index]) === null || _matches$index === void 0 ? void 0 : _matches$index.canReplace,
150
+ numReplaceable:
152
151
  // eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
153
152
  matches.filter(function (match) {
154
153
  return match.canReplace === true;
155
- }).length : undefined,
154
+ }).length,
156
155
  replaceText: replaceText,
157
156
  shouldFocus: shouldFocus,
158
157
  popupsBoundariesElement: popupsBoundariesElement,
@@ -10,7 +10,6 @@ import ChevronUpIcon from '@atlaskit/icon/core/chevron-up';
10
10
  // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
11
11
  import { Box, Inline, Text, xcss } from '@atlaskit/primitives';
12
12
  import Textfield from '@atlaskit/textfield';
13
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
14
13
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
15
14
 
16
15
  // @ts-ignore - TS1501 TypeScript 5.9.2 upgrade
@@ -25,13 +24,10 @@ var actionButtonContainerStyles = xcss({
25
24
  paddingTop: 'space.200'
26
25
  });
27
26
  var actionButtonParentInlineStyles = xcss({
28
- justifyContent: 'space-between',
29
- flexDirection: 'row-reverse'
30
- });
31
- var actionButtonParentInlineStylesNew = xcss({
32
27
  justifyContent: 'space-between',
33
28
  flexDirection: 'row-reverse',
34
- flexWrap: 'wrap'
29
+ flexWrap: 'wrap',
30
+ gap: 'space.075'
35
31
  });
36
32
  var actionButtonInlineStyles = xcss({
37
33
  gap: 'space.075'
@@ -147,7 +143,7 @@ var Replace = function Replace(_ref) {
147
143
  replaceText: replaceText
148
144
  });
149
145
  setIsHelperMessageVisible(true);
150
- if (count.totalReplaceable && expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true)) {
146
+ if (count.totalReplaceable) {
151
147
  triggerSuccessReplacementMessageUpdate(count.totalReplaceable);
152
148
  setReplaceCount(count.totalReplaceable);
153
149
  } else {
@@ -218,7 +214,7 @@ var Replace = function Replace(_ref) {
218
214
  resultsReplace.replace(SPACE_REGEX, "\xA0") : resultsReplace)), /*#__PURE__*/React.createElement(Box, {
219
215
  xcss: actionButtonContainerStyles
220
216
  }, /*#__PURE__*/React.createElement(Inline, {
221
- xcss: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? [actionButtonInlineStyles, actionButtonParentInlineStylesNew] : [actionButtonInlineStyles, actionButtonParentInlineStyles]
217
+ xcss: actionButtonParentInlineStyles
222
218
  }, /*#__PURE__*/React.createElement(Inline, {
223
219
  xcss: actionButtonInlineStyles
224
220
  }, /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
@@ -259,18 +255,14 @@ var Replace = function Replace(_ref) {
259
255
  testId: replaceAll,
260
256
  id: "replaceAll-button",
261
257
  onClick: handleReplaceAllClick,
262
- isDisabled: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? count.totalReplaceable === 0 : !canReplace
263
- }, replaceAll)), expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? /*#__PURE__*/React.createElement(Inline, {
258
+ isDisabled: count.totalReplaceable === 0
259
+ }, replaceAll)), /*#__PURE__*/React.createElement(Inline, {
264
260
  xcss: closeButtonInlineStyles
265
261
  }, /*#__PURE__*/React.createElement(Button, {
266
262
  appearance: "subtle",
267
263
  testId: closeFindReplaceDialog,
268
264
  onClick: clearSearch
269
- }, closeFindReplaceDialog)) : /*#__PURE__*/React.createElement(Button, {
270
- appearance: "subtle",
271
- testId: closeFindReplaceDialog,
272
- onClick: clearSearch
273
- }, closeFindReplaceDialog))));
265
+ }, closeFindReplaceDialog)))));
274
266
  };
275
267
 
276
268
  // eslint-disable-next-line @typescript-eslint/ban-types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "14.0.1",
3
+ "version": "14.0.3",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -24,7 +24,7 @@
24
24
  "@atlaskit/editor-plugin-analytics": "^14.0.0",
25
25
  "@atlaskit/editor-plugin-card": "^20.0.0",
26
26
  "@atlaskit/editor-plugin-expand": "^15.0.0",
27
- "@atlaskit/editor-plugin-mentions": "^16.0.0",
27
+ "@atlaskit/editor-plugin-mentions": "^16.1.0",
28
28
  "@atlaskit/editor-plugin-primary-toolbar": "^15.0.0",
29
29
  "@atlaskit/editor-plugin-synced-block": "^12.0.0",
30
30
  "@atlaskit/editor-prosemirror": "^8.0.0",
@@ -32,12 +32,12 @@
32
32
  "@atlaskit/form": "^16.1.0",
33
33
  "@atlaskit/icon": "^37.3.0",
34
34
  "@atlaskit/icon-lab": "^7.5.0",
35
- "@atlaskit/mention": "^27.13.0",
35
+ "@atlaskit/mention": "^27.15.0",
36
36
  "@atlaskit/platform-feature-flags": "^2.1.0",
37
37
  "@atlaskit/primitives": "^22.2.0",
38
38
  "@atlaskit/textfield": "^10.0.0",
39
- "@atlaskit/tmp-editor-statsig": "^143.0.0",
40
- "@atlaskit/tokens": "^16.4.0",
39
+ "@atlaskit/tmp-editor-statsig": "^145.0.0",
40
+ "@atlaskit/tokens": "^16.5.0",
41
41
  "@atlaskit/tooltip": "^24.0.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "@emotion/react": "^11.7.1",
@@ -55,7 +55,7 @@
55
55
  "react-intl": "^7.0.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^118.1.0",
58
+ "@atlaskit/editor-common": "^118.2.0",
59
59
  "react": "^18.2.0 || ^19.2.0",
60
60
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
61
61
  },