@atlaskit/editor-plugin-find-replace 1.7.20 → 1.7.22
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 +12 -0
- package/dist/cjs/pm-plugins/commands.js +4 -3
- package/dist/cjs/pm-plugins/keymap.js +2 -0
- package/dist/cjs/pm-plugins/plugin-factory.js +3 -0
- package/dist/cjs/pm-plugins/utils/batch-decorations.js +2 -0
- package/dist/cjs/pm-plugins/utils/index.js +5 -0
- package/dist/cjs/ui/FindReplaceToolbarButton.js +7 -3
- package/dist/cjs/ui/FindReplaceTooltipButton.js +6 -1
- package/dist/cjs/ui/Replace.js +4 -1
- package/dist/cjs/ui/ui-styles.js +1 -1
- package/dist/es2019/pm-plugins/commands.js +6 -4
- package/dist/es2019/pm-plugins/keymap.js +2 -0
- package/dist/es2019/pm-plugins/plugin-factory.js +3 -0
- package/dist/es2019/pm-plugins/utils/batch-decorations.js +3 -1
- package/dist/es2019/pm-plugins/utils/index.js +10 -2
- package/dist/es2019/ui/FindReplaceToolbarButton.js +9 -5
- package/dist/es2019/ui/FindReplaceTooltipButton.js +6 -1
- package/dist/es2019/ui/Replace.js +4 -1
- package/dist/es2019/ui/ui-styles.js +1 -1
- package/dist/esm/pm-plugins/commands.js +4 -3
- package/dist/esm/pm-plugins/keymap.js +2 -0
- package/dist/esm/pm-plugins/plugin-factory.js +3 -0
- package/dist/esm/pm-plugins/utils/batch-decorations.js +2 -0
- package/dist/esm/pm-plugins/utils/index.js +5 -0
- package/dist/esm/ui/FindReplaceToolbarButton.js +9 -5
- package/dist/esm/ui/FindReplaceTooltipButton.js +6 -1
- package/dist/esm/ui/Replace.js +4 -1
- package/dist/esm/ui/ui-styles.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -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;
|
|
@@ -21,7 +21,7 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
21
21
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
22
22
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
23
23
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
24
|
-
var _search = _interopRequireDefault(require("@atlaskit/icon/
|
|
24
|
+
var _search = _interopRequireDefault(require("@atlaskit/icon/core/migration/search"));
|
|
25
25
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
26
|
var _FindReplace = _interopRequireDefault(require("./FindReplace"));
|
|
27
27
|
var _templateObject;
|
|
@@ -151,7 +151,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
151
151
|
keymap: keymap
|
|
152
152
|
}),
|
|
153
153
|
iconBefore: (0, _react2.jsx)(_search.default, {
|
|
154
|
-
label: title
|
|
154
|
+
label: title,
|
|
155
|
+
spacing: "spacious"
|
|
155
156
|
}),
|
|
156
157
|
onClick: this.toggleOpen,
|
|
157
158
|
"aria-expanded": isActive,
|
|
@@ -169,7 +170,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
169
170
|
keymap: keymap
|
|
170
171
|
}),
|
|
171
172
|
iconBefore: (0, _react2.jsx)(_search.default, {
|
|
172
|
-
label: title
|
|
173
|
+
label: title,
|
|
174
|
+
spacing: "spacious"
|
|
173
175
|
}),
|
|
174
176
|
onClick: this.toggleOpen,
|
|
175
177
|
"aria-expanded": isActive,
|
|
@@ -188,6 +190,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
188
190
|
total: numMatches
|
|
189
191
|
},
|
|
190
192
|
focusToolbarButton: this.focusToolbarButton
|
|
193
|
+
// Ignored via go/ees005
|
|
194
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
191
195
|
}, this.props)))));
|
|
192
196
|
}
|
|
193
197
|
}]);
|
|
@@ -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
|
}]);
|
package/dist/cjs/ui/Replace.js
CHANGED
|
@@ -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  
|
|
242
242
|
*/
|
|
243
|
-
this.state.fakeSuccessReplacementMessageUpdate ?
|
|
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
|
package/dist/cjs/ui/ui-styles.js
CHANGED
|
@@ -90,7 +90,7 @@ var textFieldWrapper = exports.textFieldWrapper = (0, _react.css)({
|
|
|
90
90
|
label: {
|
|
91
91
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
92
92
|
fontSize: (0, _editorSharedStyles.relativeFontSizeToBase16)(14),
|
|
93
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
93
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/design-system/use-tokens-typography -- Ignored via go/DSP-18766
|
|
94
94
|
lineHeight: "".concat(gridSize * 2, "px")
|
|
95
95
|
}
|
|
96
96
|
});
|
|
@@ -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
|
-
|
|
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
|
};
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
}
|
|
@@ -15,7 +15,7 @@ import { findKeymapByDescription, getAriaKeyshortcuts, tooltip, ToolTipContent }
|
|
|
15
15
|
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
16
16
|
import { ArrowKeyNavigationType, Dropdown, TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
17
17
|
import { akEditorFloatingPanelZIndex, akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
18
|
-
import
|
|
18
|
+
import SearchIcon from '@atlaskit/icon/core/migration/search';
|
|
19
19
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
20
|
import FindReplace from './FindReplace';
|
|
21
21
|
|
|
@@ -140,8 +140,9 @@ class FindReplaceToolbarButton extends React.PureComponent {
|
|
|
140
140
|
description: title,
|
|
141
141
|
keymap: keymap
|
|
142
142
|
}),
|
|
143
|
-
iconBefore: jsx(
|
|
144
|
-
label: title
|
|
143
|
+
iconBefore: jsx(SearchIcon, {
|
|
144
|
+
label: title,
|
|
145
|
+
spacing: "spacious"
|
|
145
146
|
}),
|
|
146
147
|
onClick: this.toggleOpen,
|
|
147
148
|
"aria-expanded": isActive,
|
|
@@ -158,8 +159,9 @@ class FindReplaceToolbarButton extends React.PureComponent {
|
|
|
158
159
|
description: title,
|
|
159
160
|
keymap: keymap
|
|
160
161
|
}),
|
|
161
|
-
iconBefore: jsx(
|
|
162
|
-
label: title
|
|
162
|
+
iconBefore: jsx(SearchIcon, {
|
|
163
|
+
label: title,
|
|
164
|
+
spacing: "spacious"
|
|
163
165
|
}),
|
|
164
166
|
onClick: this.toggleOpen,
|
|
165
167
|
"aria-expanded": isActive,
|
|
@@ -178,6 +180,8 @@ class FindReplaceToolbarButton extends React.PureComponent {
|
|
|
178
180
|
total: numMatches
|
|
179
181
|
},
|
|
180
182
|
focusToolbarButton: this.focusToolbarButton
|
|
183
|
+
// Ignored via go/ees005
|
|
184
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
181
185
|
}, this.props)))));
|
|
182
186
|
}
|
|
183
187
|
}
|
|
@@ -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  
|
|
222
222
|
*/
|
|
223
|
-
this.state.fakeSuccessReplacementMessageUpdate ?
|
|
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
|
|
@@ -85,7 +85,7 @@ export const textFieldWrapper = css({
|
|
|
85
85
|
label: {
|
|
86
86
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
87
87
|
fontSize: relativeFontSizeToBase16(14),
|
|
88
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
88
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/design-system/use-tokens-typography -- Ignored via go/DSP-18766
|
|
89
89
|
lineHeight: `${gridSize * 2}px`
|
|
90
90
|
}
|
|
91
91
|
});
|
|
@@ -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;
|
|
@@ -24,7 +24,7 @@ import { findKeymapByDescription, getAriaKeyshortcuts, tooltip, ToolTipContent }
|
|
|
24
24
|
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
25
25
|
import { ArrowKeyNavigationType, Dropdown, TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
26
26
|
import { akEditorFloatingPanelZIndex, akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
27
|
-
import
|
|
27
|
+
import SearchIcon from '@atlaskit/icon/core/migration/search';
|
|
28
28
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
29
29
|
import FindReplace from './FindReplace';
|
|
30
30
|
|
|
@@ -145,8 +145,9 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
145
145
|
description: title,
|
|
146
146
|
keymap: keymap
|
|
147
147
|
}),
|
|
148
|
-
iconBefore: jsx(
|
|
149
|
-
label: title
|
|
148
|
+
iconBefore: jsx(SearchIcon, {
|
|
149
|
+
label: title,
|
|
150
|
+
spacing: "spacious"
|
|
150
151
|
}),
|
|
151
152
|
onClick: this.toggleOpen,
|
|
152
153
|
"aria-expanded": isActive,
|
|
@@ -163,8 +164,9 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
163
164
|
description: title,
|
|
164
165
|
keymap: keymap
|
|
165
166
|
}),
|
|
166
|
-
iconBefore: jsx(
|
|
167
|
-
label: title
|
|
167
|
+
iconBefore: jsx(SearchIcon, {
|
|
168
|
+
label: title,
|
|
169
|
+
spacing: "spacious"
|
|
168
170
|
}),
|
|
169
171
|
onClick: this.toggleOpen,
|
|
170
172
|
"aria-expanded": isActive,
|
|
@@ -183,6 +185,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
183
185
|
total: numMatches
|
|
184
186
|
},
|
|
185
187
|
focusToolbarButton: this.focusToolbarButton
|
|
188
|
+
// Ignored via go/ees005
|
|
189
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
186
190
|
}, this.props)))));
|
|
187
191
|
}
|
|
188
192
|
}]);
|
|
@@ -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
|
}]);
|
package/dist/esm/ui/Replace.js
CHANGED
|
@@ -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  
|
|
236
236
|
*/
|
|
237
|
-
this.state.fakeSuccessReplacementMessageUpdate ?
|
|
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/dist/esm/ui/ui-styles.js
CHANGED
|
@@ -85,7 +85,7 @@ export var textFieldWrapper = css({
|
|
|
85
85
|
label: {
|
|
86
86
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
87
87
|
fontSize: relativeFontSizeToBase16(14),
|
|
88
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
88
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/design-system/use-tokens-typography -- Ignored via go/DSP-18766
|
|
89
89
|
lineHeight: "".concat(gridSize * 2, "px")
|
|
90
90
|
}
|
|
91
91
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-find-replace",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.22",
|
|
4
4
|
"description": "find replace plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/button": "^20.3.0",
|
|
36
|
-
"@atlaskit/editor-common": "^
|
|
36
|
+
"@atlaskit/editor-common": "^99.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",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
41
41
|
"@atlaskit/form": "^11.0.0",
|
|
42
|
-
"@atlaskit/icon": "^23.
|
|
42
|
+
"@atlaskit/icon": "^23.3.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
44
44
|
"@atlaskit/primitives": "^13.3.0",
|
|
45
45
|
"@atlaskit/textfield": "^6.7.0",
|
|
46
46
|
"@atlaskit/theme": "^14.0.0",
|
|
47
|
-
"@atlaskit/tokens": "^
|
|
47
|
+
"@atlaskit/tokens": "^3.0.0",
|
|
48
48
|
"@atlaskit/tooltip": "^19.0.0",
|
|
49
49
|
"@babel/runtime": "^7.0.0",
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@af/visual-regression": "*",
|
|
56
|
-
"@atlaskit/editor-plugin-block-type": "^4.
|
|
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",
|