@atlaskit/editor-plugin-find-replace 1.7.20 → 1.7.21

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,11 @@
1
1
  # @atlaskit/editor-plugin-find-replace
2
2
 
3
+ ## 1.7.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 1.7.20
4
10
 
5
11
  ### Patch Changes
@@ -126,9 +126,9 @@ var findInDirection = function findInDirection(state, dir) {
126
126
  var replace = exports.replace = function replace(replaceText) {
127
127
  return (0, _commands.withScrollIntoView)((0, _pluginFactory.createCommand)(function (state) {
128
128
  var pluginState = (0, _pluginFactory.getPluginState)(state);
129
- var findText = pluginState.findText;
129
+ var findText = pluginState.findText,
130
+ matches = pluginState.matches;
130
131
  var decorationSet = pluginState.decorationSet,
131
- matches = pluginState.matches,
132
132
  index = pluginState.index;
133
133
  decorationSet = updateSelectedHighlight(state, (0, _utils.nextIndex)(index, matches.length));
134
134
  if (replaceText.toLowerCase().indexOf(findText.toLowerCase()) === -1) {
@@ -218,9 +218,10 @@ var toggleMatchCase = exports.toggleMatchCase = function toggleMatchCase() {
218
218
  };
219
219
  var updateSelectedHighlight = function updateSelectedHighlight(state, nextSelectedIndex) {
220
220
  var _getPluginState9 = (0, _pluginFactory.getPluginState)(state),
221
- decorationSet = _getPluginState9.decorationSet,
222
221
  index = _getPluginState9.index,
223
222
  matches = _getPluginState9.matches;
223
+ var _getPluginState10 = (0, _pluginFactory.getPluginState)(state),
224
+ decorationSet = _getPluginState10.decorationSet;
224
225
  var currentSelectedMatch = matches[index];
225
226
  var nextSelectedMatch = matches[nextSelectedIndex];
226
227
  if (index === nextSelectedIndex) {
@@ -18,6 +18,8 @@ var activateFindReplace = function activateFindReplace(editorAnalyticsAPI) {
18
18
  };
19
19
  var keymapPlugin = function keymapPlugin(editorAnalyticsAPI) {
20
20
  var list = {};
21
+ // Ignored via go/ees005
22
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
21
23
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.find.common, activateFindReplace(editorAnalyticsAPI), list);
22
24
  return (0, _keymap.keymap)(list);
23
25
  };
@@ -27,6 +27,9 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
27
27
  if (!tr.steps.find(_utils.stepHasSlice)) {
28
28
  return pluginState;
29
29
  }
30
+
31
+ // Ignored via go/ees005
32
+ // eslint-disable-next-line prefer-const
30
33
  var index = pluginState.index,
31
34
  decorationSet = pluginState.decorationSet,
32
35
  matches = pluginState.matches,
@@ -34,6 +34,8 @@ var BatchDecorations = /*#__PURE__*/function () {
34
34
  * Applies the decorations needed for the current search results
35
35
  * It does so async, splitting them up into batches to help with performance
36
36
  */
37
+ // Ignored via go/ees005
38
+ // eslint-disable-next-line @typescript-eslint/max-params
37
39
  }, {
38
40
  key: "applyAllSearchDecorations",
39
41
  value: (function () {
@@ -35,6 +35,9 @@ var createDecoration = exports.createDecoration = function createDecoration(star
35
35
  class: className
36
36
  });
37
37
  };
38
+
39
+ // Ignored via go/ees005
40
+ // eslint-disable-next-line @typescript-eslint/max-params
38
41
  function findMatches(content, searchText, shouldMatchCase) {
39
42
  var contentIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
40
43
  var matches = [];
@@ -44,6 +47,8 @@ function findMatches(content, searchText, shouldMatchCase) {
44
47
  if (!textGrouping) {
45
48
  return;
46
49
  }
50
+ // Ignored via go/ees005
51
+ // eslint-disable-next-line prefer-const
47
52
  var text = textGrouping.text,
48
53
  relativePos = textGrouping.pos;
49
54
  var pos = contentIndex + relativePos;
@@ -188,6 +188,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
188
188
  total: numMatches
189
189
  },
190
190
  focusToolbarButton: this.focusToolbarButton
191
+ // Ignored via go/ees005
192
+ // eslint-disable-next-line react/jsx-props-no-spreading
191
193
  }, this.props)))));
192
194
  }
193
195
  }]);
@@ -62,7 +62,10 @@ var FindReplaceTooltipButton = exports.FindReplaceTooltipButton = /*#__PURE__*/f
62
62
  label: title,
63
63
  appearance: appearance,
64
64
  testId: title,
65
- ref: this.buttonRef,
65
+ ref: this.buttonRef
66
+ // Ignored via go/ees005
67
+ // eslint-disable-next-line react/jsx-props-no-spreading
68
+ ,
66
69
  icon: function icon(iconProps) {
67
70
  return /*#__PURE__*/_react.default.createElement(Icon, (0, _extends2.default)({}, iconProps, {
68
71
  size: iconSize
@@ -71,6 +74,8 @@ var FindReplaceTooltipButton = exports.FindReplaceTooltipButton = /*#__PURE__*/f
71
74
  isDisabled: disabled,
72
75
  onClick: this.handleClick,
73
76
  isSelected: isPressed
77
+ // Ignored via go/ees005
78
+ // eslint-disable-next-line react/jsx-props-no-spreading
74
79
  }, pressedProps)));
75
80
  }
76
81
  }]);
@@ -240,7 +240,10 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
240
240
  Replacement needed to trigger the SR announcement if message hasn't changed. e.g Replace button clicked twice.
241
241
  '\u00a0' is value for &nbsp
242
242
  */
243
- this.state.fakeSuccessReplacementMessageUpdate ? resultsReplace.replace(/ /, "\xA0") : resultsReplace)))), (0, _react2.jsx)("div", {
243
+ this.state.fakeSuccessReplacementMessageUpdate ?
244
+ // Ignored via go/ees005
245
+ // eslint-disable-next-line require-unicode-regexp
246
+ resultsReplace.replace(/ /, "\xA0") : resultsReplace)))), (0, _react2.jsx)("div", {
244
247
  css: [_uiStyles.sectionWrapperStyles, _uiStyles.sectionWrapperStylesAlternate, _uiStyles.sectionWrapperJustified]
245
248
  }, (0, _react2.jsx)("div", {
246
249
  css: _uiStyles.orderOneStyles
@@ -118,11 +118,11 @@ const findInDirection = (state, dir) => {
118
118
  export const replace = replaceText => withScrollIntoView(createCommand(state => {
119
119
  const pluginState = getPluginState(state);
120
120
  const {
121
- findText
121
+ findText,
122
+ matches
122
123
  } = pluginState;
123
124
  let {
124
125
  decorationSet,
125
- matches,
126
126
  index
127
127
  } = pluginState;
128
128
  decorationSet = updateSelectedHighlight(state, nextIndex(index, matches.length));
@@ -203,11 +203,13 @@ export const toggleMatchCase = () => createCommand({
203
203
  type: FindReplaceActionTypes.TOGGLE_MATCH_CASE
204
204
  });
205
205
  const updateSelectedHighlight = (state, nextSelectedIndex) => {
206
- let {
207
- decorationSet,
206
+ const {
208
207
  index,
209
208
  matches
210
209
  } = getPluginState(state);
210
+ let {
211
+ decorationSet
212
+ } = getPluginState(state);
211
213
  const currentSelectedMatch = matches[index];
212
214
  const nextSelectedMatch = matches[nextSelectedIndex];
213
215
  if (index === nextSelectedIndex) {
@@ -10,6 +10,8 @@ const activateFindReplace = editorAnalyticsAPI => (state, dispatch) => {
10
10
  };
11
11
  const keymapPlugin = editorAnalyticsAPI => {
12
12
  const list = {};
13
+ // Ignored via go/ees005
14
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
13
15
  bindKeymapWithCommand(findKeymap.common, activateFindReplace(editorAnalyticsAPI), list);
14
16
  return keymap(list);
15
17
  };
@@ -17,6 +17,9 @@ const handleDocChanged = (tr, pluginState) => {
17
17
  if (!tr.steps.find(stepHasSlice)) {
18
18
  return pluginState;
19
19
  }
20
+
21
+ // Ignored via go/ees005
22
+ // eslint-disable-next-line prefer-const
20
23
  let {
21
24
  index,
22
25
  decorationSet,
@@ -19,6 +19,8 @@ class BatchDecorations {
19
19
  * Applies the decorations needed for the current search results
20
20
  * It does so async, splitting them up into batches to help with performance
21
21
  */
22
+ // Ignored via go/ees005
23
+ // eslint-disable-next-line @typescript-eslint/max-params
22
24
  async applyAllSearchDecorations(editorView, containerElement, addDecorations, removeDecorations) {
23
25
  this.stop();
24
26
  this.addDecorations = addDecorations;
@@ -71,7 +73,7 @@ class BatchDecorations {
71
73
  const selectionMatch = matches.find(match => match.start >= selection.from);
72
74
  const selectionIndex = matchesBetween.findIndex(match => match === selectionMatch);
73
75
  return await this.batchRequests(counter => {
74
- let matchesToDecorate = matchesBetween.slice(counter, counter + batchIncrement);
76
+ const matchesToDecorate = matchesBetween.slice(counter, counter + batchIncrement);
75
77
  if (matchesToDecorate.length === 0) {
76
78
  return false;
77
79
  }
@@ -22,14 +22,19 @@ export const createDecoration = (start, end, isSelected) => {
22
22
  class: className
23
23
  });
24
24
  };
25
+
26
+ // Ignored via go/ees005
27
+ // eslint-disable-next-line @typescript-eslint/max-params
25
28
  export function findMatches(content, searchText, shouldMatchCase, contentIndex = 0) {
26
- let matches = [];
29
+ const matches = [];
27
30
  const searchTextLength = searchText.length;
28
31
  let textGrouping = null;
29
32
  const collectMatch = textGrouping => {
30
33
  if (!textGrouping) {
31
34
  return;
32
35
  }
36
+ // Ignored via go/ees005
37
+ // eslint-disable-next-line prefer-const
33
38
  let {
34
39
  text,
35
40
  pos: relativePos
@@ -91,7 +96,10 @@ export function findSearchIndex(selectionPos, matches, backward = false) {
91
96
  }
92
97
  export const nextIndex = (currentIndex, total) => (currentIndex + 1) % total;
93
98
  export const prevIndex = (currentIndex, total) => (currentIndex - 1 + total) % total;
94
- export const getSelectionForMatch = (selection, doc, index, matches, offset = 0) => {
99
+ export const getSelectionForMatch = (selection, doc, index, matches, offset = 0
100
+ // Ignored via go/ees005
101
+ // eslint-disable-next-line @typescript-eslint/max-params
102
+ ) => {
95
103
  if (matches[index]) {
96
104
  return TextSelection.create(doc, matches[index].start + offset);
97
105
  }
@@ -178,6 +178,8 @@ class FindReplaceToolbarButton extends React.PureComponent {
178
178
  total: numMatches
179
179
  },
180
180
  focusToolbarButton: this.focusToolbarButton
181
+ // Ignored via go/ees005
182
+ // eslint-disable-next-line react/jsx-props-no-spreading
181
183
  }, this.props)))));
182
184
  }
183
185
  }
@@ -40,13 +40,18 @@ export class FindReplaceTooltipButton extends React.PureComponent {
40
40
  label: title,
41
41
  appearance: appearance,
42
42
  testId: title,
43
- ref: this.buttonRef,
43
+ ref: this.buttonRef
44
+ // Ignored via go/ees005
45
+ // eslint-disable-next-line react/jsx-props-no-spreading
46
+ ,
44
47
  icon: iconProps => /*#__PURE__*/React.createElement(Icon, _extends({}, iconProps, {
45
48
  size: iconSize
46
49
  })),
47
50
  isDisabled: disabled,
48
51
  onClick: this.handleClick,
49
52
  isSelected: isPressed
53
+ // Ignored via go/ees005
54
+ // eslint-disable-next-line react/jsx-props-no-spreading
50
55
  }, pressedProps)));
51
56
  }
52
57
  }
@@ -220,7 +220,10 @@ class Replace extends React.PureComponent {
220
220
  Replacement needed to trigger the SR announcement if message hasn't changed. e.g Replace button clicked twice.
221
221
  '\u00a0' is value for &nbsp
222
222
  */
223
- this.state.fakeSuccessReplacementMessageUpdate ? resultsReplace.replace(/ /, '\u00a0') : resultsReplace)))), jsx("div", {
223
+ this.state.fakeSuccessReplacementMessageUpdate ?
224
+ // Ignored via go/ees005
225
+ // eslint-disable-next-line require-unicode-regexp
226
+ resultsReplace.replace(/ /, '\u00a0') : resultsReplace)))), jsx("div", {
224
227
  css: [sectionWrapperStyles, sectionWrapperStylesAlternate, sectionWrapperJustified]
225
228
  }, jsx("div", {
226
229
  css: orderOneStyles
@@ -119,9 +119,9 @@ var findInDirection = function findInDirection(state, dir) {
119
119
  export var replace = function replace(replaceText) {
120
120
  return withScrollIntoView(createCommand(function (state) {
121
121
  var pluginState = getPluginState(state);
122
- var findText = pluginState.findText;
122
+ var findText = pluginState.findText,
123
+ matches = pluginState.matches;
123
124
  var decorationSet = pluginState.decorationSet,
124
- matches = pluginState.matches,
125
125
  index = pluginState.index;
126
126
  decorationSet = updateSelectedHighlight(state, nextIndex(index, matches.length));
127
127
  if (replaceText.toLowerCase().indexOf(findText.toLowerCase()) === -1) {
@@ -211,9 +211,10 @@ export var toggleMatchCase = function toggleMatchCase() {
211
211
  };
212
212
  var updateSelectedHighlight = function updateSelectedHighlight(state, nextSelectedIndex) {
213
213
  var _getPluginState9 = getPluginState(state),
214
- decorationSet = _getPluginState9.decorationSet,
215
214
  index = _getPluginState9.index,
216
215
  matches = _getPluginState9.matches;
216
+ var _getPluginState10 = getPluginState(state),
217
+ decorationSet = _getPluginState10.decorationSet;
217
218
  var currentSelectedMatch = matches[index];
218
219
  var nextSelectedMatch = matches[nextSelectedIndex];
219
220
  if (index === nextSelectedIndex) {
@@ -12,6 +12,8 @@ var activateFindReplace = function activateFindReplace(editorAnalyticsAPI) {
12
12
  };
13
13
  var keymapPlugin = function keymapPlugin(editorAnalyticsAPI) {
14
14
  var list = {};
15
+ // Ignored via go/ees005
16
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
15
17
  bindKeymapWithCommand(findKeymap.common, activateFindReplace(editorAnalyticsAPI), list);
16
18
  return keymap(list);
17
19
  };
@@ -19,6 +19,9 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
19
19
  if (!tr.steps.find(stepHasSlice)) {
20
20
  return pluginState;
21
21
  }
22
+
23
+ // Ignored via go/ees005
24
+ // eslint-disable-next-line prefer-const
22
25
  var index = pluginState.index,
23
26
  decorationSet = pluginState.decorationSet,
24
27
  matches = pluginState.matches,
@@ -28,6 +28,8 @@ var BatchDecorations = /*#__PURE__*/function () {
28
28
  * Applies the decorations needed for the current search results
29
29
  * It does so async, splitting them up into batches to help with performance
30
30
  */
31
+ // Ignored via go/ees005
32
+ // eslint-disable-next-line @typescript-eslint/max-params
31
33
  }, {
32
34
  key: "applyAllSearchDecorations",
33
35
  value: (function () {
@@ -25,6 +25,9 @@ export var createDecoration = function createDecoration(start, end, isSelected)
25
25
  class: className
26
26
  });
27
27
  };
28
+
29
+ // Ignored via go/ees005
30
+ // eslint-disable-next-line @typescript-eslint/max-params
28
31
  export function findMatches(content, searchText, shouldMatchCase) {
29
32
  var contentIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
30
33
  var matches = [];
@@ -34,6 +37,8 @@ export function findMatches(content, searchText, shouldMatchCase) {
34
37
  if (!textGrouping) {
35
38
  return;
36
39
  }
40
+ // Ignored via go/ees005
41
+ // eslint-disable-next-line prefer-const
37
42
  var text = textGrouping.text,
38
43
  relativePos = textGrouping.pos;
39
44
  var pos = contentIndex + relativePos;
@@ -183,6 +183,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
183
183
  total: numMatches
184
184
  },
185
185
  focusToolbarButton: this.focusToolbarButton
186
+ // Ignored via go/ees005
187
+ // eslint-disable-next-line react/jsx-props-no-spreading
186
188
  }, this.props)))));
187
189
  }
188
190
  }]);
@@ -55,7 +55,10 @@ export var FindReplaceTooltipButton = /*#__PURE__*/function (_React$PureComponen
55
55
  label: title,
56
56
  appearance: appearance,
57
57
  testId: title,
58
- ref: this.buttonRef,
58
+ ref: this.buttonRef
59
+ // Ignored via go/ees005
60
+ // eslint-disable-next-line react/jsx-props-no-spreading
61
+ ,
59
62
  icon: function icon(iconProps) {
60
63
  return /*#__PURE__*/React.createElement(Icon, _extends({}, iconProps, {
61
64
  size: iconSize
@@ -64,6 +67,8 @@ export var FindReplaceTooltipButton = /*#__PURE__*/function (_React$PureComponen
64
67
  isDisabled: disabled,
65
68
  onClick: this.handleClick,
66
69
  isSelected: isPressed
70
+ // Ignored via go/ees005
71
+ // eslint-disable-next-line react/jsx-props-no-spreading
67
72
  }, pressedProps)));
68
73
  }
69
74
  }]);
@@ -234,7 +234,10 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
234
234
  Replacement needed to trigger the SR announcement if message hasn't changed. e.g Replace button clicked twice.
235
235
  '\u00a0' is value for &nbsp
236
236
  */
237
- this.state.fakeSuccessReplacementMessageUpdate ? resultsReplace.replace(/ /, "\xA0") : resultsReplace)))), jsx("div", {
237
+ this.state.fakeSuccessReplacementMessageUpdate ?
238
+ // Ignored via go/ees005
239
+ // eslint-disable-next-line require-unicode-regexp
240
+ resultsReplace.replace(/ /, "\xA0") : resultsReplace)))), jsx("div", {
238
241
  css: [sectionWrapperStyles, sectionWrapperStylesAlternate, sectionWrapperJustified]
239
242
  }, jsx("div", {
240
243
  css: orderOneStyles
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "1.7.20",
3
+ "version": "1.7.21",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/button": "^20.3.0",
36
- "@atlaskit/editor-common": "^97.0.0",
36
+ "@atlaskit/editor-common": "^98.0.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
38
38
  "@atlaskit/editor-plugin-primary-toolbar": "^2.1.0",
39
39
  "@atlaskit/editor-prosemirror": "6.2.1",
@@ -53,7 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@af/visual-regression": "*",
56
- "@atlaskit/editor-plugin-block-type": "^4.0.0",
56
+ "@atlaskit/editor-plugin-block-type": "^4.1.0",
57
57
  "@atlaskit/editor-plugin-text-formatting": "^1.16.0",
58
58
  "@testing-library/react": "^12.1.5",
59
59
  "@testing-library/user-event": "^14.4.3",