@atlaskit/editor-plugin-find-replace 1.2.10 → 1.3.1
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 +18 -0
- package/dist/cjs/styles.js +2 -8
- package/dist/cjs/ui/Find.js +29 -80
- package/dist/cjs/ui/FindReplace.js +50 -54
- package/dist/cjs/ui/FindReplaceToolbarButton.js +8 -11
- package/dist/cjs/ui/Replace.js +15 -39
- package/dist/cjs/ui/styles.js +43 -0
- package/dist/es2019/styles.js +3 -9
- package/dist/es2019/ui/Find.js +31 -80
- package/dist/es2019/ui/FindReplace.js +51 -53
- package/dist/es2019/ui/FindReplaceToolbarButton.js +9 -11
- package/dist/es2019/ui/Replace.js +16 -38
- package/dist/es2019/ui/styles.js +43 -0
- package/dist/esm/styles.js +3 -9
- package/dist/esm/ui/Find.js +31 -80
- package/dist/esm/ui/FindReplace.js +51 -53
- package/dist/esm/ui/FindReplaceToolbarButton.js +9 -11
- package/dist/esm/ui/Replace.js +16 -38
- package/dist/esm/ui/styles.js +43 -0
- package/package.json +107 -114
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-find-replace
|
|
2
2
|
|
|
3
|
+
## 1.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#106001](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/106001)
|
|
14
|
+
[`2a3e33b1e7727`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2a3e33b1e7727) -
|
|
15
|
+
[ux] ECA11Y-75: Remove feature flag and fix tests
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 1.2.10
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/cjs/styles.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.selectedSearchMatchClass = exports.searchMatchClass = exports.findReplac
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _css;
|
|
13
12
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage/preview */
|
|
14
13
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
@@ -16,15 +15,10 @@ var _css;
|
|
|
16
15
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4290
|
|
17
16
|
var searchMatchClass = exports.searchMatchClass = 'search-match';
|
|
18
17
|
var selectedSearchMatchClass = exports.selectedSearchMatchClass = 'selected-search-match';
|
|
19
|
-
var findReplaceStyles = exports.findReplaceStyles = (0, _react.css)((_css = {}, (0, _defineProperty2.default)(_css, ".".concat(searchMatchClass),
|
|
18
|
+
var findReplaceStyles = exports.findReplaceStyles = (0, _react.css)((_css = {}, (0, _defineProperty2.default)(_css, ".".concat(searchMatchClass), {
|
|
20
19
|
borderRadius: '3px',
|
|
21
20
|
backgroundColor: "var(--ds-background-accent-teal-subtlest, #E7F9FF)",
|
|
22
21
|
boxShadow: "var(--ds-shadow-raised, ".concat("0 1px 1px 0 ".concat(_colors.N50A, ", 0 0 1px 0 ").concat(_colors.N60A), ")") + ', inset 0 0 0 1px ' + "var(--ds-border-input, ".concat("".concat(_colors.N40A), ")")
|
|
23
|
-
}
|
|
24
|
-
backgroundColor: _colors.B75
|
|
25
|
-
}), (0, _defineProperty2.default)(_css, ".".concat(selectedSearchMatchClass), (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? {
|
|
22
|
+
}), (0, _defineProperty2.default)(_css, ".".concat(selectedSearchMatchClass), {
|
|
26
23
|
backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
|
|
27
|
-
} : {
|
|
28
|
-
backgroundColor: _colors.B200,
|
|
29
|
-
color: 'white'
|
|
30
24
|
}), _css));
|
package/dist/cjs/ui/Find.js
CHANGED
|
@@ -20,16 +20,12 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
20
20
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
21
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
22
22
|
var _form = require("@atlaskit/form");
|
|
23
|
-
var _close = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/close"));
|
|
24
23
|
var _keyboard = _interopRequireDefault(require("@atlaskit/icon/glyph/emoji/keyboard"));
|
|
25
|
-
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-down"));
|
|
26
|
-
var _chevronUp = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-up"));
|
|
27
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
28
24
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
29
25
|
var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
|
|
30
26
|
var _styles = require("./styles");
|
|
31
27
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
32
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /** @jsx jsx */
|
|
28
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
33
29
|
var FIND_DEBOUNCE_MS = exports.FIND_DEBOUNCE_MS = 100;
|
|
34
30
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
35
31
|
var Find = /*#__PURE__*/function (_React$Component) {
|
|
@@ -142,10 +138,7 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
142
138
|
});
|
|
143
139
|
var formatMessage = props.intl.formatMessage;
|
|
144
140
|
_this.find = formatMessage(_messages.findReplaceMessages.find);
|
|
145
|
-
_this.closeFindReplaceDialog = formatMessage(_messages.findReplaceMessages.closeFindReplaceDialog);
|
|
146
141
|
_this.noResultsFound = formatMessage(_messages.findReplaceMessages.noResultsFound);
|
|
147
|
-
_this.findNext = formatMessage(_messages.findReplaceMessages.findNext);
|
|
148
|
-
_this.findPrevious = formatMessage(_messages.findReplaceMessages.findPrevious);
|
|
149
142
|
_this.matchCase = formatMessage(_messages.findReplaceMessages.matchCase);
|
|
150
143
|
|
|
151
144
|
// We locally manage the value of the input inside this component in order to support compositions.
|
|
@@ -209,26 +202,31 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
209
202
|
selectedMatchPosition: count.index + 1,
|
|
210
203
|
totalResultsCount: count.total
|
|
211
204
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
205
|
+
var elemAfterInput =
|
|
206
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
207
|
+
(0, _react2.jsx)("div", {
|
|
208
|
+
css: _styles.afterInputSection
|
|
209
|
+
}, (0, _react2.jsx)("div", {
|
|
210
|
+
"aria-live": "polite"
|
|
211
|
+
}, findText &&
|
|
212
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
213
|
+
(0, _react2.jsx)("span", {
|
|
214
|
+
"data-testid": "textfield-count",
|
|
215
|
+
css: [_styles.countStyles, _styles.countStylesAlternateStyles]
|
|
216
|
+
}, count.total === 0 ? this.noResultsFound : resultsCount)), (0, _react2.jsx)("div", {
|
|
217
|
+
css: _styles.matchCaseSection
|
|
218
|
+
}, (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
219
|
+
title: this.matchCase,
|
|
220
|
+
appearance: "default",
|
|
221
|
+
icon: _keyboard.default,
|
|
222
|
+
iconLabel: this.matchCase,
|
|
223
|
+
iconSize: 'small',
|
|
224
|
+
onClick: this.handleMatchCaseClick,
|
|
225
|
+
isPressed: shouldMatchCase
|
|
226
|
+
})));
|
|
227
|
+
return (
|
|
228
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
229
|
+
(0, _react2.jsx)("div", {
|
|
232
230
|
css: [_styles.sectionWrapperStyles, _styles.sectionWrapperStylesAlternate]
|
|
233
231
|
}, (0, _react2.jsx)("div", {
|
|
234
232
|
css: _styles.textFieldWrapper
|
|
@@ -237,6 +235,7 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
237
235
|
}, this.find), (0, _react2.jsx)(_textfield.default, {
|
|
238
236
|
name: "find",
|
|
239
237
|
id: "find-text-field",
|
|
238
|
+
testId: "find-field",
|
|
240
239
|
appearance: "standard",
|
|
241
240
|
value: this.state.localFindText,
|
|
242
241
|
ref: this.findTextfieldRef,
|
|
@@ -248,58 +247,8 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
248
247
|
onCompositionStart: this.handleCompositionStart,
|
|
249
248
|
onCompositionEnd: this.handleCompositionEnd,
|
|
250
249
|
elemAfterInput: elemAfterInput
|
|
251
|
-
})))
|
|
252
|
-
|
|
253
|
-
return (0, _react2.jsx)("div", {
|
|
254
|
-
css: _styles.sectionWrapperStyles
|
|
255
|
-
}, (0, _react2.jsx)(_textfield.default, {
|
|
256
|
-
name: "find",
|
|
257
|
-
appearance: "none",
|
|
258
|
-
placeholder: this.find,
|
|
259
|
-
value: this.state.localFindText,
|
|
260
|
-
ref: this.findTextfieldRef,
|
|
261
|
-
autoComplete: "off",
|
|
262
|
-
onChange: this.handleFindChange,
|
|
263
|
-
onKeyDown: this.handleFindKeyDown,
|
|
264
|
-
onKeyUp: this.handleFindKeyUp,
|
|
265
|
-
onBlur: this.props.onFindBlur,
|
|
266
|
-
onCompositionStart: this.handleCompositionStart,
|
|
267
|
-
onCompositionEnd: this.handleCompositionEnd
|
|
268
|
-
}), (0, _react2.jsx)("div", {
|
|
269
|
-
css: _styles.countWrapperStyles,
|
|
270
|
-
"aria-live": "polite"
|
|
271
|
-
}, findText && (0, _react2.jsx)("span", {
|
|
272
|
-
"data-testid": "textfield-count",
|
|
273
|
-
css: _styles.countStyles
|
|
274
|
-
}, count.total === 0 ? this.noResultsFound : resultsCount)), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
275
|
-
title: this.matchCase,
|
|
276
|
-
icon: _keyboard.default,
|
|
277
|
-
iconLabel: this.matchCase,
|
|
278
|
-
iconSize: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? 'small' : undefined,
|
|
279
|
-
onClick: this.handleMatchCaseClick,
|
|
280
|
-
isPressed: shouldMatchCase
|
|
281
|
-
}), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
282
|
-
title: this.findNext,
|
|
283
|
-
icon: _chevronDown.default,
|
|
284
|
-
iconLabel: this.findNext,
|
|
285
|
-
keymapDescription: 'Enter',
|
|
286
|
-
onClick: this.handleFindNextClick,
|
|
287
|
-
disabled: count.total <= 1
|
|
288
|
-
}), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
289
|
-
title: this.findPrevious,
|
|
290
|
-
icon: _chevronUp.default,
|
|
291
|
-
iconLabel: this.findPrevious,
|
|
292
|
-
keymapDescription: 'Shift Enter',
|
|
293
|
-
onClick: this.handleFindPrevClick,
|
|
294
|
-
disabled: count.total <= 1
|
|
295
|
-
}), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
296
|
-
title: this.closeFindReplaceDialog,
|
|
297
|
-
icon: _close.default,
|
|
298
|
-
iconLabel: this.closeFindReplaceDialog,
|
|
299
|
-
keymapDescription: 'Escape',
|
|
300
|
-
onClick: this.clearSearch
|
|
301
|
-
}));
|
|
302
|
-
}
|
|
250
|
+
})))
|
|
251
|
+
);
|
|
303
252
|
}
|
|
304
253
|
}]);
|
|
305
254
|
return Find;
|
|
@@ -14,12 +14,11 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _Find = _interopRequireDefault(require("./Find"));
|
|
19
18
|
var _Replace = _interopRequireDefault(require("./Replace"));
|
|
20
19
|
var _styles = require("./styles");
|
|
21
20
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
22
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /* eslint-disable @atlaskit/design-system/prefer-primitives */ /** @jsx jsx */
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /* eslint-disable @atlaskit/design-system/prefer-primitives */ /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
23
22
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
24
23
|
var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
25
24
|
(0, _inherits2.default)(FindReplace, _React$PureComponent);
|
|
@@ -57,11 +56,9 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
57
56
|
findTyped: false
|
|
58
57
|
});
|
|
59
58
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setFindTyped", function (value) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
}
|
|
59
|
+
_this.setState({
|
|
60
|
+
findTyped: value
|
|
61
|
+
});
|
|
65
62
|
});
|
|
66
63
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setFindTextfieldRef", function (findTextfieldRef) {
|
|
67
64
|
_this.findTextfield = findTextfieldRef.current;
|
|
@@ -85,18 +82,14 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
85
82
|
(0, _createClass2.default)(FindReplace, [{
|
|
86
83
|
key: "componentDidMount",
|
|
87
84
|
value: function componentDidMount() {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
window.addEventListener('keydown', this.handleTabNavigation);
|
|
91
|
-
}
|
|
85
|
+
// eslint-disable-next-line
|
|
86
|
+
window.addEventListener('keydown', this.handleTabNavigation);
|
|
92
87
|
}
|
|
93
88
|
}, {
|
|
94
89
|
key: "componentWillUnmount",
|
|
95
90
|
value: function componentWillUnmount() {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
window.removeEventListener('keydown', this.handleTabNavigation);
|
|
99
|
-
}
|
|
91
|
+
// eslint-disable-next-line
|
|
92
|
+
window.removeEventListener('keydown', this.handleTabNavigation);
|
|
100
93
|
}
|
|
101
94
|
}, {
|
|
102
95
|
key: "render",
|
|
@@ -117,45 +110,48 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
117
110
|
allowMatchCase = _this$props.allowMatchCase,
|
|
118
111
|
shouldMatchCase = _this$props.shouldMatchCase,
|
|
119
112
|
onToggleMatchCase = _this$props.onToggleMatchCase;
|
|
120
|
-
var focusToolbarButton =
|
|
121
|
-
return (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
113
|
+
var focusToolbarButton = this.props.focusToolbarButton || function () {};
|
|
114
|
+
return (
|
|
115
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
116
|
+
(0, _react2.jsx)("div", {
|
|
117
|
+
ref: this.modalRef,
|
|
118
|
+
css: [_styles.wrapperStyles, _styles.wrapperPaddingStyles]
|
|
119
|
+
}, (0, _react2.jsx)(_Find.default, {
|
|
120
|
+
allowMatchCase: allowMatchCase,
|
|
121
|
+
shouldMatchCase: shouldMatchCase,
|
|
122
|
+
onToggleMatchCase: onToggleMatchCase,
|
|
123
|
+
findText: findText,
|
|
124
|
+
count: count,
|
|
125
|
+
shouldFocus: shouldFocus,
|
|
126
|
+
onFind: onFind,
|
|
127
|
+
onFindBlur: onFindBlur,
|
|
128
|
+
onFindPrev: onFindPrev,
|
|
129
|
+
onFindNext: onFindNext,
|
|
130
|
+
onFindTextfieldRefSet: this.setFindTextfieldRef,
|
|
131
|
+
onCancel: onCancel,
|
|
132
|
+
onArrowDown: this.setFocusToReplace,
|
|
133
|
+
findTyped: this.state.findTyped,
|
|
134
|
+
setFindTyped: this.setFindTyped
|
|
135
|
+
}), (0, _react2.jsx)("hr", {
|
|
136
|
+
css: _styles.ruleStyles,
|
|
137
|
+
id: "replace-hr-element"
|
|
138
|
+
}), (0, _react2.jsx)(_Replace.default, {
|
|
139
|
+
canReplace: count.total > 0,
|
|
140
|
+
replaceText: replaceText,
|
|
141
|
+
onReplace: onReplace,
|
|
142
|
+
onReplaceAll: onReplaceAll,
|
|
143
|
+
onReplaceTextfieldRefSet: this.setReplaceTextfieldRef,
|
|
144
|
+
onArrowUp: this.setFocusToFind,
|
|
145
|
+
onCancel: onCancel,
|
|
146
|
+
count: count,
|
|
147
|
+
onFindPrev: onFindPrev,
|
|
148
|
+
onFindNext: onFindNext,
|
|
149
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
150
|
+
findTyped: this.state.findTyped,
|
|
151
|
+
setFindTyped: this.setFindTyped,
|
|
152
|
+
focusToolbarButton: focusToolbarButton
|
|
153
|
+
}))
|
|
154
|
+
);
|
|
159
155
|
}
|
|
160
156
|
}]);
|
|
161
157
|
return FindReplace;
|
|
@@ -23,11 +23,11 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
23
23
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
24
24
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
25
25
|
var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/search"));
|
|
26
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
26
|
var _FindReplace = _interopRequireDefault(require("./FindReplace"));
|
|
28
27
|
var _templateObject;
|
|
29
28
|
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
30
29
|
/** @jsx jsx */
|
|
30
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
31
31
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
32
32
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
33
33
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
@@ -40,7 +40,6 @@ var wrapper = (0, _react2.css)({
|
|
|
40
40
|
flexDirection: 'column'
|
|
41
41
|
});
|
|
42
42
|
var dropdownWidthNewDesign = 382;
|
|
43
|
-
var dropdownWidthOldDesign = 352;
|
|
44
43
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
45
44
|
var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
46
45
|
(0, _inherits2.default)(FindReplaceToolbarButton, _React$PureComponent);
|
|
@@ -109,17 +108,15 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
109
108
|
_this2.props.onCancel({
|
|
110
109
|
triggerMethod: _analytics.TRIGGER_METHOD.KEYBOARD
|
|
111
110
|
});
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
_this2.toolbarButtonRef.current.focus();
|
|
115
|
-
}
|
|
116
|
-
_this2.setState({
|
|
117
|
-
openedByClick: false
|
|
118
|
-
});
|
|
111
|
+
if (_this2.state.openedByClick && _this2.toolbarButtonRef.current) {
|
|
112
|
+
_this2.toolbarButtonRef.current.focus();
|
|
119
113
|
}
|
|
114
|
+
_this2.setState({
|
|
115
|
+
openedByClick: false
|
|
116
|
+
});
|
|
120
117
|
}
|
|
121
118
|
},
|
|
122
|
-
fitWidth:
|
|
119
|
+
fitWidth: dropdownWidthNewDesign,
|
|
123
120
|
zIndex: stackBelowOtherEditorFloatingPanels,
|
|
124
121
|
arrowKeyNavigationProviderOptions: {
|
|
125
122
|
type: _uiMenu.ArrowKeyNavigationType.MENU,
|
|
@@ -141,7 +138,7 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
141
138
|
"aria-haspopup": true,
|
|
142
139
|
"aria-label": keymap ? (0, _keymaps.tooltip)(keymap, title) : title,
|
|
143
140
|
"aria-keyshortcuts": (0, _keymaps.getAriaKeyshortcuts)(keymap),
|
|
144
|
-
ref:
|
|
141
|
+
ref: this.toolbarButtonRef
|
|
145
142
|
})
|
|
146
143
|
}, (0, _react2.jsx)("div", {
|
|
147
144
|
css: wrapper
|
package/dist/cjs/ui/Replace.js
CHANGED
|
@@ -22,7 +22,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
22
22
|
var _form = require("@atlaskit/form");
|
|
23
23
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-down"));
|
|
24
24
|
var _chevronUp = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-up"));
|
|
25
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
25
|
var _primitives = require("@atlaskit/primitives");
|
|
27
26
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
28
27
|
var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
|
|
@@ -30,7 +29,7 @@ var _styles = require("./styles");
|
|
|
30
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
31
30
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
31
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
33
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /** @jsx jsx */
|
|
32
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /** @jsx jsx */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
34
33
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
35
34
|
var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
36
35
|
(0, _inherits2.default)(Replace, _React$PureComponent);
|
|
@@ -153,7 +152,6 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
153
152
|
fakeSuccessReplacementMessageUpdate: false,
|
|
154
153
|
replaceCount: 0
|
|
155
154
|
};
|
|
156
|
-
_this.replaceWith = formatMessage(_messages.findReplaceMessages.replaceWith);
|
|
157
155
|
_this.replace = formatMessage(_messages.findReplaceMessages.replace);
|
|
158
156
|
_this.replaceAll = formatMessage(_messages.findReplaceMessages.replaceAll);
|
|
159
157
|
_this.findNext = formatMessage(_messages.findReplaceMessages.findNext);
|
|
@@ -177,13 +175,11 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
177
175
|
isComposing: false
|
|
178
176
|
});
|
|
179
177
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
findTextField.focus();
|
|
186
|
-
}
|
|
178
|
+
var findTextField = document.getElementById('find-text-field');
|
|
179
|
+
var replaceButton = document.getElementById('replace-button');
|
|
180
|
+
var replaceAllButton = document.getElementById('replaceAll-button');
|
|
181
|
+
if (((replaceButton === null || replaceButton === void 0 ? void 0 : replaceButton.tabIndex) === -1 || (replaceAllButton === null || replaceAllButton === void 0 ? void 0 : replaceAllButton.tabIndex) === -1) && findTextField) {
|
|
182
|
+
findTextField.focus();
|
|
187
183
|
}
|
|
188
184
|
}
|
|
189
185
|
}, {
|
|
@@ -215,7 +211,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
215
211
|
var resultsReplace = formatMessage(_messages.findReplaceMessages.replaceSuccess, {
|
|
216
212
|
numberOfMatches: replaceCount
|
|
217
213
|
});
|
|
218
|
-
return (0,
|
|
214
|
+
return (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("div", {
|
|
219
215
|
css: [_styles.sectionWrapperStyles, _styles.sectionWrapperStylesAlternate]
|
|
220
216
|
}, (0, _react2.jsx)("div", {
|
|
221
217
|
css: _styles.textFieldWrapper
|
|
@@ -224,6 +220,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
224
220
|
}, "Replace with"), (0, _react2.jsx)(_textfield.default, {
|
|
225
221
|
name: "replace",
|
|
226
222
|
id: "replace-text-field",
|
|
223
|
+
testId: "replace-field",
|
|
227
224
|
appearance: "standard",
|
|
228
225
|
defaultValue: replaceText,
|
|
229
226
|
ref: this.replaceTextfieldRef,
|
|
@@ -238,9 +235,9 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
238
235
|
testId: "message-success-replacement"
|
|
239
236
|
},
|
|
240
237
|
/*
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
238
|
+
Replacement needed to trigger the SR announcement if message hasn't changed. e.g Replace button clicked twice.
|
|
239
|
+
'\u00a0' is value for  
|
|
240
|
+
*/
|
|
244
241
|
this.state.fakeSuccessReplacementMessageUpdate ? resultsReplace.replace(/ /, "\xA0") : resultsReplace)))), (0, _react2.jsx)("div", {
|
|
245
242
|
css: [_styles.sectionWrapperStyles, _styles.sectionWrapperStylesAlternate, _styles.sectionWrapperJustified]
|
|
246
243
|
}, (0, _react2.jsx)("div", {
|
|
@@ -264,7 +261,9 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
264
261
|
onClick: this.handleFindPrevClick,
|
|
265
262
|
disabled: count.total <= 1
|
|
266
263
|
})), (0, _react2.jsx)(_primitives.Inline, {
|
|
267
|
-
space: "space.075"
|
|
264
|
+
space: "space.075"
|
|
265
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
266
|
+
,
|
|
268
267
|
xcss: (0, _primitives.xcss)({
|
|
269
268
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
270
269
|
paddingInlineStart: 'space.050',
|
|
@@ -288,30 +287,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
288
287
|
appearance: "subtle",
|
|
289
288
|
testId: this.closeFindReplaceDialog,
|
|
290
289
|
onClick: this.clearSearch
|
|
291
|
-
}, this.closeFindReplaceDialog))))
|
|
292
|
-
css: _styles.sectionWrapperStyles
|
|
293
|
-
}, (0, _react2.jsx)(_textfield.default, {
|
|
294
|
-
name: "replace",
|
|
295
|
-
appearance: "none",
|
|
296
|
-
placeholder: this.replaceWith,
|
|
297
|
-
defaultValue: replaceText,
|
|
298
|
-
ref: this.replaceTextfieldRef,
|
|
299
|
-
autoComplete: "off",
|
|
300
|
-
onChange: this.handleReplaceChange,
|
|
301
|
-
onKeyDown: this.handleReplaceKeyDown,
|
|
302
|
-
onCompositionStart: this.handleCompositionStart,
|
|
303
|
-
onCompositionEnd: this.handleCompositionEnd
|
|
304
|
-
}), (0, _react2.jsx)(_primitives.Inline, {
|
|
305
|
-
space: "space.050"
|
|
306
|
-
}, (0, _react2.jsx)(_new.default, {
|
|
307
|
-
testId: this.replace,
|
|
308
|
-
onClick: this.handleReplaceClick,
|
|
309
|
-
isDisabled: !canReplace
|
|
310
|
-
}, this.replace), (0, _react2.jsx)(_new.default, {
|
|
311
|
-
testId: this.replaceAll,
|
|
312
|
-
onClick: this.handleReplaceAllClick,
|
|
313
|
-
isDisabled: !canReplace
|
|
314
|
-
}, this.replaceAll)));
|
|
290
|
+
}, this.closeFindReplaceDialog))));
|
|
315
291
|
}
|
|
316
292
|
}]);
|
|
317
293
|
return Replace;
|