@atlaskit/editor-plugin-find-replace 2.4.2 → 2.5.0

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.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#171615](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/171615)
8
+ [`d4542dcef1f93`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d4542dcef1f93) -
9
+ [ux] [ED-28254] this change is adding case matching to Find with status nodes behind the
10
+ platform_editor_find_and_replace_part_2 flag
11
+
3
12
  ## 2.4.2
4
13
 
5
14
  ### Patch Changes
@@ -71,9 +71,21 @@ function findMatches(content, searchText, shouldMatchCase) {
71
71
  if (!textGrouping) {
72
72
  return;
73
73
  }
74
- var text = textGrouping.text,
75
- pos = textGrouping.pos;
76
- var index = text.toLowerCase().indexOf(searchText.toLowerCase());
74
+ var pos = textGrouping.pos;
75
+ var text = textGrouping.text;
76
+ // status text is rendered in all caps regardless so case matching should work if the search text is all caps
77
+ if ((0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_part_2')) {
78
+ if (shouldMatchCase) {
79
+ text = text.toUpperCase();
80
+ } else {
81
+ text = text.toLowerCase();
82
+ searchText = searchText.toLowerCase();
83
+ }
84
+ } else {
85
+ text = text.toLowerCase();
86
+ searchText = searchText.toLowerCase();
87
+ }
88
+ var index = text.indexOf(searchText);
77
89
  if (index !== -1) {
78
90
  var start = pos;
79
91
  matches.push({
@@ -60,10 +60,24 @@ export function findMatches(content, searchText, shouldMatchCase, contentIndex =
60
60
  return;
61
61
  }
62
62
  const {
63
- text,
64
63
  pos
65
64
  } = textGrouping;
66
- const index = text.toLowerCase().indexOf(searchText.toLowerCase());
65
+ let {
66
+ text
67
+ } = textGrouping;
68
+ // status text is rendered in all caps regardless so case matching should work if the search text is all caps
69
+ if (fg('platform_editor_find_and_replace_part_2')) {
70
+ if (shouldMatchCase) {
71
+ text = text.toUpperCase();
72
+ } else {
73
+ text = text.toLowerCase();
74
+ searchText = searchText.toLowerCase();
75
+ }
76
+ } else {
77
+ text = text.toLowerCase();
78
+ searchText = searchText.toLowerCase();
79
+ }
80
+ const index = text.indexOf(searchText);
67
81
  if (index !== -1) {
68
82
  const start = pos;
69
83
  matches.push({
@@ -61,9 +61,21 @@ export function findMatches(content, searchText, shouldMatchCase) {
61
61
  if (!textGrouping) {
62
62
  return;
63
63
  }
64
- var text = textGrouping.text,
65
- pos = textGrouping.pos;
66
- var index = text.toLowerCase().indexOf(searchText.toLowerCase());
64
+ var pos = textGrouping.pos;
65
+ var text = textGrouping.text;
66
+ // status text is rendered in all caps regardless so case matching should work if the search text is all caps
67
+ if (fg('platform_editor_find_and_replace_part_2')) {
68
+ if (shouldMatchCase) {
69
+ text = text.toUpperCase();
70
+ } else {
71
+ text = text.toLowerCase();
72
+ searchText = searchText.toLowerCase();
73
+ }
74
+ } else {
75
+ text = text.toLowerCase();
76
+ searchText = searchText.toLowerCase();
77
+ }
78
+ var index = text.indexOf(searchText);
67
79
  if (index !== -1) {
68
80
  var start = pos;
69
81
  matches.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "2.4.2",
3
+ "version": "2.5.0",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -118,6 +118,9 @@
118
118
  },
119
119
  "platform_editor_find_and_replace_1": {
120
120
  "type": "boolean"
121
+ },
122
+ "platform_editor_find_and_replace_part_2": {
123
+ "type": "boolean"
121
124
  }
122
125
  }
123
126
  }