@atlaskit/editor-plugin-find-replace 2.2.7 → 2.2.8

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,14 @@
1
1
  # @atlaskit/editor-plugin-find-replace
2
2
 
3
+ ## 2.2.8
4
+
5
+ ### Patch Changes
6
+
7
+ - [#165597](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165597)
8
+ [`7091d26926b74`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7091d26926b74) -
9
+ [ED-28128] this change is adding an optional field to the Match type in the FindReplace plugin
10
+ - Updated dependencies
11
+
3
12
  ## 2.2.7
4
13
 
5
14
  ### Patch Changes
@@ -40,7 +40,8 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
40
40
  var mappedMatches = matches.map(function (match) {
41
41
  return {
42
42
  start: tr.mapping.map(match.start),
43
- end: tr.mapping.map(match.end)
43
+ end: tr.mapping.map(match.end),
44
+ canReplace: match.canReplace
44
45
  };
45
46
  });
46
47
  var matchesToAdd = [];
@@ -10,6 +10,7 @@ exports.getSelectedText = getSelectedText;
10
10
  exports.removeMatchesFromSet = exports.removeDecorationsFromSet = exports.prevIndex = exports.nextIndex = exports.isMatchAffectedByStep = exports.getSelectionForMatch = void 0;
11
11
  var _state = require("@atlaskit/editor-prosemirror/state");
12
12
  var _view = require("@atlaskit/editor-prosemirror/view");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _styles = require("../../ui/styles");
14
15
  function getSelectedText(selection) {
15
16
  var text = '';
@@ -60,7 +61,8 @@ function findMatches(content, searchText, shouldMatchCase) {
60
61
  // Add the substring index to the position of the node
61
62
  matches.push({
62
63
  start: pos + index,
63
- end: pos + end
64
+ end: pos + end,
65
+ canReplace: (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1') ? true : undefined
64
66
  });
65
67
  index = text.indexOf(searchText, end);
66
68
  }
@@ -31,7 +31,8 @@ const handleDocChanged = (tr, pluginState) => {
31
31
  const numDecorations = decorationSet.find().length;
32
32
  const mappedMatches = matches.map(match => ({
33
33
  start: tr.mapping.map(match.start),
34
- end: tr.mapping.map(match.end)
34
+ end: tr.mapping.map(match.end),
35
+ canReplace: match.canReplace
35
36
  }));
36
37
  let matchesToAdd = [];
37
38
  let matchesToDelete = [];
@@ -1,5 +1,6 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { searchMatchClass, selectedSearchMatchClass } from '../../ui/styles';
4
5
  export function getSelectedText(selection) {
5
6
  let text = '';
@@ -48,7 +49,8 @@ export function findMatches(content, searchText, shouldMatchCase, contentIndex =
48
49
  // Add the substring index to the position of the node
49
50
  matches.push({
50
51
  start: pos + index,
51
- end: pos + end
52
+ end: pos + end,
53
+ canReplace: fg('platform_editor_find_and_replace_1') ? true : undefined
52
54
  });
53
55
  index = text.indexOf(searchText, end);
54
56
  }
@@ -32,7 +32,8 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
32
32
  var mappedMatches = matches.map(function (match) {
33
33
  return {
34
34
  start: tr.mapping.map(match.start),
35
- end: tr.mapping.map(match.end)
35
+ end: tr.mapping.map(match.end),
36
+ canReplace: match.canReplace
36
37
  };
37
38
  });
38
39
  var matchesToAdd = [];
@@ -1,5 +1,6 @@
1
1
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
2
2
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { searchMatchClass, selectedSearchMatchClass } from '../../ui/styles';
4
5
  export function getSelectedText(selection) {
5
6
  var text = '';
@@ -50,7 +51,8 @@ export function findMatches(content, searchText, shouldMatchCase) {
50
51
  // Add the substring index to the position of the node
51
52
  matches.push({
52
53
  start: pos + index,
53
- end: pos + end
54
+ end: pos + end,
55
+ canReplace: fg('platform_editor_find_and_replace_1') ? true : undefined
54
56
  });
55
57
  index = text.indexOf(searchText, end);
56
58
  }
@@ -42,6 +42,8 @@ export type Match = {
42
42
  start: number;
43
43
  /** End position */
44
44
  end: number;
45
+ /** Boolean for whether the match can be replaced */
46
+ canReplace?: boolean;
45
47
  };
46
48
  export type TextGrouping = {
47
49
  /** The concatenated text across nodes */
@@ -42,6 +42,8 @@ export type Match = {
42
42
  start: number;
43
43
  /** End position */
44
44
  end: number;
45
+ /** Boolean for whether the match can be replaced */
46
+ canReplace?: boolean;
45
47
  };
46
48
  export type TextGrouping = {
47
49
  /** The concatenated text across nodes */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "2.2.7",
3
+ "version": "2.2.8",
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": "^23.2.0",
36
- "@atlaskit/editor-common": "^106.1.0",
36
+ "@atlaskit/editor-common": "^106.2.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
38
38
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
39
39
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -44,9 +44,9 @@
44
44
  "@atlaskit/primitives": "^14.8.0",
45
45
  "@atlaskit/textfield": "^8.0.0",
46
46
  "@atlaskit/theme": "^18.0.0",
47
- "@atlaskit/tmp-editor-statsig": "^5.7.0",
47
+ "@atlaskit/tmp-editor-statsig": "^5.12.0",
48
48
  "@atlaskit/tokens": "^5.0.0",
49
- "@atlaskit/tooltip": "^20.2.0",
49
+ "@atlaskit/tooltip": "^20.3.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1",
52
52
  "lodash": "^4.17.21",
@@ -118,6 +118,9 @@
118
118
  },
119
119
  "editor_a11y_refactor_find_replace_style": {
120
120
  "type": "boolean"
121
+ },
122
+ "platform_editor_find_and_replace_1": {
123
+ "type": "boolean"
121
124
  }
122
125
  }
123
126
  }