@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/dist/es2019/ui/styles.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/no-nested-styles */
|
|
2
2
|
/* eslint-disable @repo/internal/styles/no-exported-styles */
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
5
|
import { css } from '@emotion/react';
|
|
5
6
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
6
7
|
import { N30A } from '@atlaskit/theme/colors';
|
|
@@ -9,6 +10,8 @@ import { fontSize as getFontSize,
|
|
|
9
10
|
gridSize as getGridSize } from '@atlaskit/theme/constants';
|
|
10
11
|
const fontSize = getFontSize();
|
|
11
12
|
const gridSize = getGridSize();
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
12
15
|
export const ruleStyles = css({
|
|
13
16
|
width: '100%',
|
|
14
17
|
border: 'none',
|
|
@@ -17,67 +20,99 @@ export const ruleStyles = css({
|
|
|
17
20
|
height: '1px',
|
|
18
21
|
borderRadius: '1px'
|
|
19
22
|
});
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
20
25
|
export const wrapperStyles = css({
|
|
21
26
|
display: 'flex',
|
|
22
27
|
flexDirection: 'column',
|
|
28
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
23
29
|
'> *:not(#replace-hr-element)': {
|
|
24
30
|
margin: `0px ${"var(--ds-space-050, 4px)"}`
|
|
25
31
|
}
|
|
26
32
|
});
|
|
33
|
+
|
|
34
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
27
35
|
export const wrapperPaddingStyles = css({
|
|
28
36
|
padding: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-050, 4px)"}`
|
|
29
37
|
});
|
|
38
|
+
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
30
40
|
export const sectionWrapperStyles = css({
|
|
31
41
|
display: 'flex',
|
|
42
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
32
43
|
'& > *': {
|
|
33
44
|
display: 'inline-flex',
|
|
34
45
|
height: '32px',
|
|
35
46
|
flex: '0 0 auto'
|
|
36
47
|
},
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
37
49
|
'& > [data-ds--text-field--container]': {
|
|
38
50
|
display: 'flex',
|
|
39
51
|
flex: '1 1 auto'
|
|
40
52
|
}
|
|
41
53
|
});
|
|
54
|
+
|
|
55
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
42
56
|
export const sectionWrapperStylesAlternate = css({
|
|
43
57
|
display: 'flex',
|
|
44
58
|
padding: "var(--ds-space-100, 8px)",
|
|
59
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
45
60
|
'& > *': {
|
|
46
61
|
height: 'unset'
|
|
47
62
|
}
|
|
48
63
|
});
|
|
64
|
+
|
|
65
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
49
66
|
export const sectionWrapperJustified = css({
|
|
50
67
|
justifyContent: 'space-between',
|
|
68
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
51
69
|
fontSize: relativeFontSizeToBase16(14)
|
|
52
70
|
});
|
|
71
|
+
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
53
73
|
export const textFieldWrapper = css({
|
|
54
74
|
flex: '1 100%',
|
|
55
75
|
flexWrap: 'wrap',
|
|
76
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
56
77
|
'#find-text-field, #replace-text-field': {
|
|
78
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
57
79
|
height: `${gridSize * 4.5 / fontSize}em`
|
|
58
80
|
},
|
|
81
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
59
82
|
label: {
|
|
83
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
60
84
|
fontSize: relativeFontSizeToBase16(14),
|
|
85
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
61
86
|
lineHeight: `${gridSize * 2}px`
|
|
62
87
|
}
|
|
63
88
|
});
|
|
89
|
+
|
|
90
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
64
91
|
export const afterInputSection = css({
|
|
65
92
|
display: 'flex',
|
|
66
93
|
flex: '0 0 auto',
|
|
67
94
|
alignItems: 'center'
|
|
68
95
|
});
|
|
96
|
+
|
|
97
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
69
98
|
export const matchCaseSection = css({
|
|
70
99
|
paddingRight: "var(--ds-space-100, 8px)",
|
|
100
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors -- Ignored via go/DSP-18766
|
|
71
101
|
button: {
|
|
72
102
|
width: '20px',
|
|
73
103
|
height: '20px'
|
|
74
104
|
}
|
|
75
105
|
});
|
|
106
|
+
|
|
107
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
76
108
|
export const nextPreviousItemStyles = css({
|
|
77
109
|
padding: `0px ${"var(--ds-space-025, 2px)"}`
|
|
78
110
|
});
|
|
111
|
+
|
|
112
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
79
113
|
export const countStyles = css({
|
|
80
114
|
color: `${"var(--ds-text-subtlest, #626F86)"}`,
|
|
115
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
81
116
|
fontSize: `${relativeFontSizeToBase16(12)}`,
|
|
82
117
|
flex: '0 0 auto',
|
|
83
118
|
justifyContent: 'center',
|
|
@@ -85,17 +120,25 @@ export const countStyles = css({
|
|
|
85
120
|
marginLeft: "var(--ds-space-050, 4px)",
|
|
86
121
|
marginRight: "var(--ds-space-100, 8px)"
|
|
87
122
|
});
|
|
123
|
+
|
|
124
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
88
125
|
export const countStylesAlternateStyles = css({
|
|
89
126
|
display: 'inline-flex',
|
|
90
127
|
height: '32px'
|
|
91
128
|
});
|
|
129
|
+
|
|
130
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
92
131
|
export const countWrapperStyles = css({
|
|
93
132
|
alignItems: 'center'
|
|
94
133
|
});
|
|
134
|
+
|
|
135
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
95
136
|
export const orderZeroStyles = css({
|
|
96
137
|
order: '0',
|
|
97
138
|
marginInline: `${"var(--ds-space-050, 4px)"} ${"var(--ds-space-025, 2px)"}`
|
|
98
139
|
});
|
|
140
|
+
|
|
141
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles, @atlaskit/design-system/no-exported-css -- Ignored via go/DSP-18766
|
|
99
142
|
export const orderOneStyles = css({
|
|
100
143
|
order: '1'
|
|
101
144
|
});
|
package/dist/esm/styles.js
CHANGED
|
@@ -6,19 +6,13 @@ var _css;
|
|
|
6
6
|
|
|
7
7
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-4290
|
|
8
8
|
import { css } from '@emotion/react';
|
|
9
|
-
import {
|
|
10
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { N40A, N50A, N60A } from '@atlaskit/theme/colors';
|
|
11
10
|
export var searchMatchClass = 'search-match';
|
|
12
11
|
export var selectedSearchMatchClass = 'selected-search-match';
|
|
13
|
-
export var findReplaceStyles = css((_css = {}, _defineProperty(_css, ".".concat(searchMatchClass),
|
|
12
|
+
export var findReplaceStyles = css((_css = {}, _defineProperty(_css, ".".concat(searchMatchClass), {
|
|
14
13
|
borderRadius: '3px',
|
|
15
14
|
backgroundColor: "var(--ds-background-accent-teal-subtlest, #E7F9FF)",
|
|
16
15
|
boxShadow: "var(--ds-shadow-raised, ".concat("0 1px 1px 0 ".concat(N50A, ", 0 0 1px 0 ").concat(N60A), ")") + ', inset 0 0 0 1px ' + "var(--ds-border-input, ".concat("".concat(N40A), ")")
|
|
17
|
-
}
|
|
18
|
-
backgroundColor: B75
|
|
19
|
-
}), _defineProperty(_css, ".".concat(selectedSearchMatchClass), getBooleanFF('platform.editor.a11y-find-replace') ? {
|
|
16
|
+
}), _defineProperty(_css, ".".concat(selectedSearchMatchClass), {
|
|
20
17
|
backgroundColor: "var(--ds-background-accent-teal-subtle, #6CC3E0)"
|
|
21
|
-
} : {
|
|
22
|
-
backgroundColor: B200,
|
|
23
|
-
color: 'white'
|
|
24
18
|
}), _css));
|
package/dist/esm/ui/Find.js
CHANGED
|
@@ -10,6 +10,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
10
10
|
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
import React from 'react';
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
15
|
import { jsx } from '@emotion/react';
|
|
14
16
|
import debounce from 'lodash/debounce';
|
|
15
17
|
import rafSchd from 'raf-schd';
|
|
@@ -17,14 +19,10 @@ import { injectIntl } from 'react-intl-next';
|
|
|
17
19
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
18
20
|
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
19
21
|
import { Label } from '@atlaskit/form';
|
|
20
|
-
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
21
22
|
import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
|
|
22
|
-
import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
|
|
23
|
-
import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
|
|
24
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
23
|
import Textfield from '@atlaskit/textfield';
|
|
26
24
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
27
|
-
import { afterInputSection, countStyles, countStylesAlternateStyles,
|
|
25
|
+
import { afterInputSection, countStyles, countStylesAlternateStyles, matchCaseSection, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
|
|
28
26
|
export var FIND_DEBOUNCE_MS = 100;
|
|
29
27
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
30
28
|
var Find = /*#__PURE__*/function (_React$Component) {
|
|
@@ -137,10 +135,7 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
137
135
|
});
|
|
138
136
|
var formatMessage = props.intl.formatMessage;
|
|
139
137
|
_this.find = formatMessage(messages.find);
|
|
140
|
-
_this.closeFindReplaceDialog = formatMessage(messages.closeFindReplaceDialog);
|
|
141
138
|
_this.noResultsFound = formatMessage(messages.noResultsFound);
|
|
142
|
-
_this.findNext = formatMessage(messages.findNext);
|
|
143
|
-
_this.findPrevious = formatMessage(messages.findPrevious);
|
|
144
139
|
_this.matchCase = formatMessage(messages.matchCase);
|
|
145
140
|
|
|
146
141
|
// We locally manage the value of the input inside this component in order to support compositions.
|
|
@@ -204,26 +199,31 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
204
199
|
selectedMatchPosition: count.index + 1,
|
|
205
200
|
totalResultsCount: count.total
|
|
206
201
|
});
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
202
|
+
var elemAfterInput =
|
|
203
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
204
|
+
jsx("div", {
|
|
205
|
+
css: afterInputSection
|
|
206
|
+
}, jsx("div", {
|
|
207
|
+
"aria-live": "polite"
|
|
208
|
+
}, findText &&
|
|
209
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
210
|
+
jsx("span", {
|
|
211
|
+
"data-testid": "textfield-count",
|
|
212
|
+
css: [countStyles, countStylesAlternateStyles]
|
|
213
|
+
}, count.total === 0 ? this.noResultsFound : resultsCount)), jsx("div", {
|
|
214
|
+
css: matchCaseSection
|
|
215
|
+
}, jsx(FindReplaceTooltipButton, {
|
|
216
|
+
title: this.matchCase,
|
|
217
|
+
appearance: "default",
|
|
218
|
+
icon: MatchCaseIcon,
|
|
219
|
+
iconLabel: this.matchCase,
|
|
220
|
+
iconSize: 'small',
|
|
221
|
+
onClick: this.handleMatchCaseClick,
|
|
222
|
+
isPressed: shouldMatchCase
|
|
223
|
+
})));
|
|
224
|
+
return (
|
|
225
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
226
|
+
jsx("div", {
|
|
227
227
|
css: [sectionWrapperStyles, sectionWrapperStylesAlternate]
|
|
228
228
|
}, jsx("div", {
|
|
229
229
|
css: textFieldWrapper
|
|
@@ -232,6 +232,7 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
232
232
|
}, this.find), jsx(Textfield, {
|
|
233
233
|
name: "find",
|
|
234
234
|
id: "find-text-field",
|
|
235
|
+
testId: "find-field",
|
|
235
236
|
appearance: "standard",
|
|
236
237
|
value: this.state.localFindText,
|
|
237
238
|
ref: this.findTextfieldRef,
|
|
@@ -243,58 +244,8 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
243
244
|
onCompositionStart: this.handleCompositionStart,
|
|
244
245
|
onCompositionEnd: this.handleCompositionEnd,
|
|
245
246
|
elemAfterInput: elemAfterInput
|
|
246
|
-
})))
|
|
247
|
-
|
|
248
|
-
return jsx("div", {
|
|
249
|
-
css: sectionWrapperStyles
|
|
250
|
-
}, jsx(Textfield, {
|
|
251
|
-
name: "find",
|
|
252
|
-
appearance: "none",
|
|
253
|
-
placeholder: this.find,
|
|
254
|
-
value: this.state.localFindText,
|
|
255
|
-
ref: this.findTextfieldRef,
|
|
256
|
-
autoComplete: "off",
|
|
257
|
-
onChange: this.handleFindChange,
|
|
258
|
-
onKeyDown: this.handleFindKeyDown,
|
|
259
|
-
onKeyUp: this.handleFindKeyUp,
|
|
260
|
-
onBlur: this.props.onFindBlur,
|
|
261
|
-
onCompositionStart: this.handleCompositionStart,
|
|
262
|
-
onCompositionEnd: this.handleCompositionEnd
|
|
263
|
-
}), jsx("div", {
|
|
264
|
-
css: countWrapperStyles,
|
|
265
|
-
"aria-live": "polite"
|
|
266
|
-
}, findText && jsx("span", {
|
|
267
|
-
"data-testid": "textfield-count",
|
|
268
|
-
css: countStyles
|
|
269
|
-
}, count.total === 0 ? this.noResultsFound : resultsCount)), jsx(FindReplaceTooltipButton, {
|
|
270
|
-
title: this.matchCase,
|
|
271
|
-
icon: MatchCaseIcon,
|
|
272
|
-
iconLabel: this.matchCase,
|
|
273
|
-
iconSize: getBooleanFF('platform.editor.a11y-find-replace') ? 'small' : undefined,
|
|
274
|
-
onClick: this.handleMatchCaseClick,
|
|
275
|
-
isPressed: shouldMatchCase
|
|
276
|
-
}), jsx(FindReplaceTooltipButton, {
|
|
277
|
-
title: this.findNext,
|
|
278
|
-
icon: ChevronDownIcon,
|
|
279
|
-
iconLabel: this.findNext,
|
|
280
|
-
keymapDescription: 'Enter',
|
|
281
|
-
onClick: this.handleFindNextClick,
|
|
282
|
-
disabled: count.total <= 1
|
|
283
|
-
}), jsx(FindReplaceTooltipButton, {
|
|
284
|
-
title: this.findPrevious,
|
|
285
|
-
icon: ChevronUpIcon,
|
|
286
|
-
iconLabel: this.findPrevious,
|
|
287
|
-
keymapDescription: 'Shift Enter',
|
|
288
|
-
onClick: this.handleFindPrevClick,
|
|
289
|
-
disabled: count.total <= 1
|
|
290
|
-
}), jsx(FindReplaceTooltipButton, {
|
|
291
|
-
title: this.closeFindReplaceDialog,
|
|
292
|
-
icon: EditorCloseIcon,
|
|
293
|
-
iconLabel: this.closeFindReplaceDialog,
|
|
294
|
-
keymapDescription: 'Escape',
|
|
295
|
-
onClick: this.clearSearch
|
|
296
|
-
}));
|
|
297
|
-
}
|
|
247
|
+
})))
|
|
248
|
+
);
|
|
298
249
|
}
|
|
299
250
|
}]);
|
|
300
251
|
return Find;
|
|
@@ -11,8 +11,9 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
11
11
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
12
12
|
/** @jsx jsx */
|
|
13
13
|
import React from 'react';
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
16
|
import { jsx } from '@emotion/react';
|
|
15
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import Find from './Find';
|
|
17
18
|
import Replace from './Replace';
|
|
18
19
|
import { ruleStyles, wrapperPaddingStyles, wrapperStyles } from './styles';
|
|
@@ -53,11 +54,9 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
53
54
|
findTyped: false
|
|
54
55
|
});
|
|
55
56
|
_defineProperty(_assertThisInitialized(_this), "setFindTyped", function (value) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
}
|
|
57
|
+
_this.setState({
|
|
58
|
+
findTyped: value
|
|
59
|
+
});
|
|
61
60
|
});
|
|
62
61
|
_defineProperty(_assertThisInitialized(_this), "setFindTextfieldRef", function (findTextfieldRef) {
|
|
63
62
|
_this.findTextfield = findTextfieldRef.current;
|
|
@@ -81,18 +80,14 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
81
80
|
_createClass(FindReplace, [{
|
|
82
81
|
key: "componentDidMount",
|
|
83
82
|
value: function componentDidMount() {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
window.addEventListener('keydown', this.handleTabNavigation);
|
|
87
|
-
}
|
|
83
|
+
// eslint-disable-next-line
|
|
84
|
+
window.addEventListener('keydown', this.handleTabNavigation);
|
|
88
85
|
}
|
|
89
86
|
}, {
|
|
90
87
|
key: "componentWillUnmount",
|
|
91
88
|
value: function componentWillUnmount() {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
window.removeEventListener('keydown', this.handleTabNavigation);
|
|
95
|
-
}
|
|
89
|
+
// eslint-disable-next-line
|
|
90
|
+
window.removeEventListener('keydown', this.handleTabNavigation);
|
|
96
91
|
}
|
|
97
92
|
}, {
|
|
98
93
|
key: "render",
|
|
@@ -113,45 +108,48 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
113
108
|
allowMatchCase = _this$props.allowMatchCase,
|
|
114
109
|
shouldMatchCase = _this$props.shouldMatchCase,
|
|
115
110
|
onToggleMatchCase = _this$props.onToggleMatchCase;
|
|
116
|
-
var focusToolbarButton =
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
111
|
+
var focusToolbarButton = this.props.focusToolbarButton || function () {};
|
|
112
|
+
return (
|
|
113
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
114
|
+
jsx("div", {
|
|
115
|
+
ref: this.modalRef,
|
|
116
|
+
css: [wrapperStyles, wrapperPaddingStyles]
|
|
117
|
+
}, jsx(Find, {
|
|
118
|
+
allowMatchCase: allowMatchCase,
|
|
119
|
+
shouldMatchCase: shouldMatchCase,
|
|
120
|
+
onToggleMatchCase: onToggleMatchCase,
|
|
121
|
+
findText: findText,
|
|
122
|
+
count: count,
|
|
123
|
+
shouldFocus: shouldFocus,
|
|
124
|
+
onFind: onFind,
|
|
125
|
+
onFindBlur: onFindBlur,
|
|
126
|
+
onFindPrev: onFindPrev,
|
|
127
|
+
onFindNext: onFindNext,
|
|
128
|
+
onFindTextfieldRefSet: this.setFindTextfieldRef,
|
|
129
|
+
onCancel: onCancel,
|
|
130
|
+
onArrowDown: this.setFocusToReplace,
|
|
131
|
+
findTyped: this.state.findTyped,
|
|
132
|
+
setFindTyped: this.setFindTyped
|
|
133
|
+
}), jsx("hr", {
|
|
134
|
+
css: ruleStyles,
|
|
135
|
+
id: "replace-hr-element"
|
|
136
|
+
}), jsx(Replace, {
|
|
137
|
+
canReplace: count.total > 0,
|
|
138
|
+
replaceText: replaceText,
|
|
139
|
+
onReplace: onReplace,
|
|
140
|
+
onReplaceAll: onReplaceAll,
|
|
141
|
+
onReplaceTextfieldRefSet: this.setReplaceTextfieldRef,
|
|
142
|
+
onArrowUp: this.setFocusToFind,
|
|
143
|
+
onCancel: onCancel,
|
|
144
|
+
count: count,
|
|
145
|
+
onFindPrev: onFindPrev,
|
|
146
|
+
onFindNext: onFindNext,
|
|
147
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
148
|
+
findTyped: this.state.findTyped,
|
|
149
|
+
setFindTyped: this.setFindTyped,
|
|
150
|
+
focusToolbarButton: focusToolbarButton
|
|
151
|
+
}))
|
|
152
|
+
);
|
|
155
153
|
}
|
|
156
154
|
}]);
|
|
157
155
|
return FindReplace;
|
|
@@ -13,6 +13,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
13
13
|
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
import React from 'react';
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
18
|
import { css, jsx } from '@emotion/react';
|
|
17
19
|
import { injectIntl } from 'react-intl-next';
|
|
18
20
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -21,7 +23,6 @@ import { findReplaceMessages as messages } from '@atlaskit/editor-common/message
|
|
|
21
23
|
import { ArrowKeyNavigationType, Dropdown, TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
22
24
|
import { akEditorFloatingPanelZIndex, akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
23
25
|
import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
24
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
25
26
|
import FindReplace from './FindReplace';
|
|
26
27
|
|
|
27
28
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
|
|
@@ -34,7 +35,6 @@ var wrapper = css({
|
|
|
34
35
|
flexDirection: 'column'
|
|
35
36
|
});
|
|
36
37
|
var dropdownWidthNewDesign = 382;
|
|
37
|
-
var dropdownWidthOldDesign = 352;
|
|
38
38
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
39
39
|
var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
40
40
|
_inherits(FindReplaceToolbarButton, _React$PureComponent);
|
|
@@ -103,17 +103,15 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
103
103
|
_this2.props.onCancel({
|
|
104
104
|
triggerMethod: TRIGGER_METHOD.KEYBOARD
|
|
105
105
|
});
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
_this2.toolbarButtonRef.current.focus();
|
|
109
|
-
}
|
|
110
|
-
_this2.setState({
|
|
111
|
-
openedByClick: false
|
|
112
|
-
});
|
|
106
|
+
if (_this2.state.openedByClick && _this2.toolbarButtonRef.current) {
|
|
107
|
+
_this2.toolbarButtonRef.current.focus();
|
|
113
108
|
}
|
|
109
|
+
_this2.setState({
|
|
110
|
+
openedByClick: false
|
|
111
|
+
});
|
|
114
112
|
}
|
|
115
113
|
},
|
|
116
|
-
fitWidth:
|
|
114
|
+
fitWidth: dropdownWidthNewDesign,
|
|
117
115
|
zIndex: stackBelowOtherEditorFloatingPanels,
|
|
118
116
|
arrowKeyNavigationProviderOptions: {
|
|
119
117
|
type: ArrowKeyNavigationType.MENU,
|
|
@@ -135,7 +133,7 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
135
133
|
"aria-haspopup": true,
|
|
136
134
|
"aria-label": keymap ? tooltip(keymap, title) : title,
|
|
137
135
|
"aria-keyshortcuts": getAriaKeyshortcuts(keymap),
|
|
138
|
-
ref:
|
|
136
|
+
ref: this.toolbarButtonRef
|
|
139
137
|
})
|
|
140
138
|
}, jsx("div", {
|
|
141
139
|
css: wrapper
|
package/dist/esm/ui/Replace.js
CHANGED
|
@@ -10,6 +10,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
10
10
|
/* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
import React, { Fragment } from 'react';
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
15
|
import { jsx } from '@emotion/react';
|
|
14
16
|
import { injectIntl } from 'react-intl-next';
|
|
15
17
|
import Button from '@atlaskit/button/new';
|
|
@@ -18,7 +20,6 @@ import { findReplaceMessages as messages } from '@atlaskit/editor-common/message
|
|
|
18
20
|
import { Label, ValidMessage } from '@atlaskit/form';
|
|
19
21
|
import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
|
|
20
22
|
import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
|
|
21
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
22
23
|
import { Inline, xcss } from '@atlaskit/primitives';
|
|
23
24
|
import Textfield from '@atlaskit/textfield';
|
|
24
25
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
@@ -145,7 +146,6 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
145
146
|
fakeSuccessReplacementMessageUpdate: false,
|
|
146
147
|
replaceCount: 0
|
|
147
148
|
};
|
|
148
|
-
_this.replaceWith = formatMessage(messages.replaceWith);
|
|
149
149
|
_this.replace = formatMessage(messages.replace);
|
|
150
150
|
_this.replaceAll = formatMessage(messages.replaceAll);
|
|
151
151
|
_this.findNext = formatMessage(messages.findNext);
|
|
@@ -169,13 +169,11 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
169
169
|
isComposing: false
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
findTextField.focus();
|
|
178
|
-
}
|
|
172
|
+
var findTextField = document.getElementById('find-text-field');
|
|
173
|
+
var replaceButton = document.getElementById('replace-button');
|
|
174
|
+
var replaceAllButton = document.getElementById('replaceAll-button');
|
|
175
|
+
if (((replaceButton === null || replaceButton === void 0 ? void 0 : replaceButton.tabIndex) === -1 || (replaceAllButton === null || replaceAllButton === void 0 ? void 0 : replaceAllButton.tabIndex) === -1) && findTextField) {
|
|
176
|
+
findTextField.focus();
|
|
179
177
|
}
|
|
180
178
|
}
|
|
181
179
|
}, {
|
|
@@ -207,7 +205,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
207
205
|
var resultsReplace = formatMessage(messages.replaceSuccess, {
|
|
208
206
|
numberOfMatches: replaceCount
|
|
209
207
|
});
|
|
210
|
-
return
|
|
208
|
+
return jsx(Fragment, null, jsx("div", {
|
|
211
209
|
css: [sectionWrapperStyles, sectionWrapperStylesAlternate]
|
|
212
210
|
}, jsx("div", {
|
|
213
211
|
css: textFieldWrapper
|
|
@@ -216,6 +214,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
216
214
|
}, "Replace with"), jsx(Textfield, {
|
|
217
215
|
name: "replace",
|
|
218
216
|
id: "replace-text-field",
|
|
217
|
+
testId: "replace-field",
|
|
219
218
|
appearance: "standard",
|
|
220
219
|
defaultValue: replaceText,
|
|
221
220
|
ref: this.replaceTextfieldRef,
|
|
@@ -230,9 +229,9 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
230
229
|
testId: "message-success-replacement"
|
|
231
230
|
},
|
|
232
231
|
/*
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
Replacement needed to trigger the SR announcement if message hasn't changed. e.g Replace button clicked twice.
|
|
233
|
+
'\u00a0' is value for  
|
|
234
|
+
*/
|
|
236
235
|
this.state.fakeSuccessReplacementMessageUpdate ? resultsReplace.replace(/ /, "\xA0") : resultsReplace)))), jsx("div", {
|
|
237
236
|
css: [sectionWrapperStyles, sectionWrapperStylesAlternate, sectionWrapperJustified]
|
|
238
237
|
}, jsx("div", {
|
|
@@ -256,7 +255,9 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
256
255
|
onClick: this.handleFindPrevClick,
|
|
257
256
|
disabled: count.total <= 1
|
|
258
257
|
})), jsx(Inline, {
|
|
259
|
-
space: "space.075"
|
|
258
|
+
space: "space.075"
|
|
259
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
260
|
+
,
|
|
260
261
|
xcss: xcss({
|
|
261
262
|
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
262
263
|
paddingInlineStart: 'space.050',
|
|
@@ -280,30 +281,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
280
281
|
appearance: "subtle",
|
|
281
282
|
testId: this.closeFindReplaceDialog,
|
|
282
283
|
onClick: this.clearSearch
|
|
283
|
-
}, this.closeFindReplaceDialog))))
|
|
284
|
-
css: sectionWrapperStyles
|
|
285
|
-
}, jsx(Textfield, {
|
|
286
|
-
name: "replace",
|
|
287
|
-
appearance: "none",
|
|
288
|
-
placeholder: this.replaceWith,
|
|
289
|
-
defaultValue: replaceText,
|
|
290
|
-
ref: this.replaceTextfieldRef,
|
|
291
|
-
autoComplete: "off",
|
|
292
|
-
onChange: this.handleReplaceChange,
|
|
293
|
-
onKeyDown: this.handleReplaceKeyDown,
|
|
294
|
-
onCompositionStart: this.handleCompositionStart,
|
|
295
|
-
onCompositionEnd: this.handleCompositionEnd
|
|
296
|
-
}), jsx(Inline, {
|
|
297
|
-
space: "space.050"
|
|
298
|
-
}, jsx(Button, {
|
|
299
|
-
testId: this.replace,
|
|
300
|
-
onClick: this.handleReplaceClick,
|
|
301
|
-
isDisabled: !canReplace
|
|
302
|
-
}, this.replace), jsx(Button, {
|
|
303
|
-
testId: this.replaceAll,
|
|
304
|
-
onClick: this.handleReplaceAllClick,
|
|
305
|
-
isDisabled: !canReplace
|
|
306
|
-
}, this.replaceAll)));
|
|
284
|
+
}, this.closeFindReplaceDialog))));
|
|
307
285
|
}
|
|
308
286
|
}]);
|
|
309
287
|
return Replace;
|