@atlaskit/editor-plugin-find-replace 6.0.9 → 6.1.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 +11 -0
- package/dist/cjs/ui/FindReplace.js +1 -60
- package/dist/cjs/ui/Replace.js +232 -310
- package/dist/es2019/ui/FindReplace.js +1 -52
- package/dist/es2019/ui/Replace.js +213 -302
- package/dist/esm/ui/FindReplace.js +1 -60
- package/dist/esm/ui/Replace.js +234 -317
- package/dist/types/ui/FindReplace.d.ts +0 -7
- package/dist/types/ui/Replace.d.ts +0 -11
- package/dist/types-ts4.5/ui/FindReplace.d.ts +0 -7
- package/dist/types-ts4.5/ui/Replace.d.ts +0 -11
- package/package.json +9 -12
- package/dist/cjs/ui/ReplaceNext.js +0 -277
- package/dist/es2019/ui/ReplaceNext.js +0 -242
- package/dist/esm/ui/ReplaceNext.js +0 -267
- package/dist/types/ui/ReplaceNext.d.ts +0 -39
- package/dist/types-ts4.5/ui/ReplaceNext.d.ts +0 -39
|
@@ -16,11 +16,9 @@ import React from 'react';
|
|
|
16
16
|
|
|
17
17
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
18
18
|
import { jsx } from '@emotion/react';
|
|
19
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
20
19
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
21
20
|
import Find from './Find';
|
|
22
21
|
import Replace from './Replace';
|
|
23
|
-
import ReplaceNext from './ReplaceNext';
|
|
24
22
|
import { ruleStyles, wrapperPaddingStyles, wrapperStyles } from './ui-styles';
|
|
25
23
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
26
24
|
var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
@@ -30,36 +28,6 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
30
28
|
_this = _callSuper(this, FindReplace, [props]);
|
|
31
29
|
_defineProperty(_this, "findTextfield", null);
|
|
32
30
|
_defineProperty(_this, "replaceTextfield", null);
|
|
33
|
-
/**
|
|
34
|
-
* Delete this function on cleanup of
|
|
35
|
-
* editor_a11y_refactor_find_replace_style
|
|
36
|
-
*/
|
|
37
|
-
_defineProperty(_this, "handleTabNavigation", function (event) {
|
|
38
|
-
if (fg('editor_a11y_refactor_find_replace_style')) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (event.key === 'Tab') {
|
|
42
|
-
event.preventDefault();
|
|
43
|
-
var modalFindReplace = _this.modalRef.current;
|
|
44
|
-
if (!modalFindReplace || !modalFindReplace.contains(document.activeElement)) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
var focusableElements = Array.from(modalFindReplace.querySelectorAll('[tabindex]:not([tabindex="-1"]), input, button')).filter(function (el) {
|
|
48
|
-
return el.getAttribute('tabindex') !== '-1';
|
|
49
|
-
});
|
|
50
|
-
var currentIndex = focusableElements.findIndex(function (el) {
|
|
51
|
-
return el === document.activeElement;
|
|
52
|
-
});
|
|
53
|
-
var isShiftPressed = event.shiftKey;
|
|
54
|
-
if (isShiftPressed) {
|
|
55
|
-
var prevIndex = (currentIndex - 1 + focusableElements.length) % focusableElements.length;
|
|
56
|
-
focusableElements[prevIndex].focus();
|
|
57
|
-
} else {
|
|
58
|
-
var nextIndex = (currentIndex + 1) % focusableElements.length;
|
|
59
|
-
focusableElements[nextIndex].focus();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
31
|
_defineProperty(_this, "state", {
|
|
64
32
|
findTyped: false
|
|
65
33
|
});
|
|
@@ -89,18 +57,6 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
89
57
|
}
|
|
90
58
|
_inherits(FindReplace, _React$PureComponent);
|
|
91
59
|
return _createClass(FindReplace, [{
|
|
92
|
-
key: "componentDidMount",
|
|
93
|
-
value: function componentDidMount() {
|
|
94
|
-
// eslint-disable-next-line
|
|
95
|
-
window.addEventListener('keydown', this.handleTabNavigation);
|
|
96
|
-
}
|
|
97
|
-
}, {
|
|
98
|
-
key: "componentWillUnmount",
|
|
99
|
-
value: function componentWillUnmount() {
|
|
100
|
-
// eslint-disable-next-line
|
|
101
|
-
window.removeEventListener('keydown', this.handleTabNavigation);
|
|
102
|
-
}
|
|
103
|
-
}, {
|
|
104
60
|
key: "render",
|
|
105
61
|
value: function render() {
|
|
106
62
|
var _this$props = this.props,
|
|
@@ -149,22 +105,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
149
105
|
role: "presentation",
|
|
150
106
|
css: ruleStyles,
|
|
151
107
|
id: "replace-hr-element"
|
|
152
|
-
}),
|
|
153
|
-
canReplace: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? !!isReplaceable : count.total > 0,
|
|
154
|
-
replaceText: replaceText,
|
|
155
|
-
onReplace: onReplace,
|
|
156
|
-
onReplaceAll: onReplaceAll,
|
|
157
|
-
onReplaceTextfieldRefSet: this.setReplaceTextfieldRef,
|
|
158
|
-
onArrowUp: this.setFocusToFind,
|
|
159
|
-
onCancel: onCancel,
|
|
160
|
-
count: count,
|
|
161
|
-
onFindPrev: onFindPrev,
|
|
162
|
-
onFindNext: onFindNext,
|
|
163
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
164
|
-
findTyped: this.state.findTyped,
|
|
165
|
-
setFindTyped: this.setFindTyped,
|
|
166
|
-
focusToolbarButton: focusToolbarButton
|
|
167
|
-
}) : jsx(Replace, {
|
|
108
|
+
}), jsx(Replace, {
|
|
168
109
|
canReplace: expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? !!isReplaceable : count.total > 0,
|
|
169
110
|
replaceText: replaceText,
|
|
170
111
|
onReplace: onReplace,
|