@atlaskit/editor-plugin-find-replace 0.3.0 → 0.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 +7 -0
- package/dist/cjs/ui/Find.js +8 -44
- package/dist/cjs/ui/FindReplaceToolbarButton.js +2 -8
- package/dist/cjs/ui/Replace.js +9 -56
- package/dist/es2019/ui/Find.js +2 -38
- package/dist/es2019/ui/FindReplaceToolbarButton.js +2 -8
- package/dist/es2019/ui/Replace.js +2 -49
- package/dist/esm/ui/Find.js +2 -38
- package/dist/esm/ui/FindReplaceToolbarButton.js +2 -8
- package/dist/esm/ui/Replace.js +2 -49
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-find-replace
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#71136](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/71136) [`c803fea1e6a4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c803fea1e6a4) - Move all plugin translations to editor-common
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 0.3.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
package/dist/cjs/ui/Find.js
CHANGED
|
@@ -18,6 +18,7 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
|
18
18
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
19
19
|
var _reactIntlNext = require("react-intl-next");
|
|
20
20
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
21
22
|
var _form = require("@atlaskit/form");
|
|
22
23
|
var _close = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/close"));
|
|
23
24
|
var _keyboard = _interopRequireDefault(require("@atlaskit/icon/glyph/emoji/keyboard"));
|
|
@@ -30,43 +31,6 @@ var _styles = require("./styles");
|
|
|
30
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); }; }
|
|
31
32
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /** @jsx jsx */
|
|
32
33
|
var FIND_DEBOUNCE_MS = exports.FIND_DEBOUNCE_MS = 100;
|
|
33
|
-
var messages = (0, _reactIntlNext.defineMessages)({
|
|
34
|
-
find: {
|
|
35
|
-
id: 'fabric.editor.find',
|
|
36
|
-
defaultMessage: 'Find',
|
|
37
|
-
description: 'The word or phrase to search for on the document'
|
|
38
|
-
},
|
|
39
|
-
matchCase: {
|
|
40
|
-
id: 'fabric.editor.matchCase',
|
|
41
|
-
defaultMessage: 'Match case',
|
|
42
|
-
description: 'Toggle whether should also match case when searching for text'
|
|
43
|
-
},
|
|
44
|
-
findNext: {
|
|
45
|
-
id: 'fabric.editor.findNext',
|
|
46
|
-
defaultMessage: 'Find next',
|
|
47
|
-
description: 'Locate the next occurrence of the word or phrase that was searched for'
|
|
48
|
-
},
|
|
49
|
-
findPrevious: {
|
|
50
|
-
id: 'fabric.editor.findPrevious',
|
|
51
|
-
defaultMessage: 'Find previous',
|
|
52
|
-
description: 'Locate the previous occurrence of the word or phrase that was searched for'
|
|
53
|
-
},
|
|
54
|
-
closeFindReplaceDialog: {
|
|
55
|
-
id: 'fabric.editor.closeFindReplaceDialog',
|
|
56
|
-
defaultMessage: 'Close',
|
|
57
|
-
description: 'Cancel search and close the "Find and Replace" dialog'
|
|
58
|
-
},
|
|
59
|
-
noResultsFound: {
|
|
60
|
-
id: 'fabric.editor.noResultsFound',
|
|
61
|
-
defaultMessage: 'No results',
|
|
62
|
-
description: 'No matches were found for the word or phrase that was searched for'
|
|
63
|
-
},
|
|
64
|
-
resultsCount: {
|
|
65
|
-
id: 'fabric.editor.resultsCount',
|
|
66
|
-
description: 'Text for selected search match position and total results count',
|
|
67
|
-
defaultMessage: '{selectedMatchPosition} of {totalResultsCount}'
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
34
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
71
35
|
var Find = /*#__PURE__*/function (_React$Component) {
|
|
72
36
|
(0, _inherits2.default)(Find, _React$Component);
|
|
@@ -177,12 +141,12 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
177
141
|
}
|
|
178
142
|
});
|
|
179
143
|
var formatMessage = props.intl.formatMessage;
|
|
180
|
-
_this.find = formatMessage(
|
|
181
|
-
_this.closeFindReplaceDialog = formatMessage(
|
|
182
|
-
_this.noResultsFound = formatMessage(
|
|
183
|
-
_this.findNext = formatMessage(
|
|
184
|
-
_this.findPrevious = formatMessage(
|
|
185
|
-
_this.matchCase = formatMessage(
|
|
144
|
+
_this.find = formatMessage(_messages.findReplaceMessages.find);
|
|
145
|
+
_this.closeFindReplaceDialog = formatMessage(_messages.findReplaceMessages.closeFindReplaceDialog);
|
|
146
|
+
_this.noResultsFound = formatMessage(_messages.findReplaceMessages.noResultsFound);
|
|
147
|
+
_this.findNext = formatMessage(_messages.findReplaceMessages.findNext);
|
|
148
|
+
_this.findPrevious = formatMessage(_messages.findReplaceMessages.findPrevious);
|
|
149
|
+
_this.matchCase = formatMessage(_messages.findReplaceMessages.matchCase);
|
|
186
150
|
_this.matchCaseIcon = (0, _react2.jsx)(_keyboard.default, {
|
|
187
151
|
label: _this.matchCase,
|
|
188
152
|
size: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? 'small' : 'medium'
|
|
@@ -255,7 +219,7 @@ var Find = /*#__PURE__*/function (_React$Component) {
|
|
|
255
219
|
allowMatchCase = _this$props.allowMatchCase,
|
|
256
220
|
shouldMatchCase = _this$props.shouldMatchCase,
|
|
257
221
|
formatMessage = _this$props.intl.formatMessage;
|
|
258
|
-
var resultsCount = formatMessage(
|
|
222
|
+
var resultsCount = formatMessage(_messages.findReplaceMessages.resultsCount, {
|
|
259
223
|
selectedMatchPosition: count.index + 1,
|
|
260
224
|
totalResultsCount: count.total
|
|
261
225
|
});
|
|
@@ -19,6 +19,7 @@ var _react2 = require("@emotion/react");
|
|
|
19
19
|
var _reactIntlNext = require("react-intl-next");
|
|
20
20
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
21
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
22
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
22
23
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
23
24
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
24
25
|
var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/search"));
|
|
@@ -32,13 +33,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
32
33
|
var toolbarButtonWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex: 1 1 auto;\n flex-grow: 0;\n justify-content: flex-end;\n align-items: center;\n padding: 0 ", ";\n @media (max-width: ", "px) {\n justify-content: center;\n padding: 0;\n }\n"])), "var(--ds-space-100, 8px)", _editorSharedStyles.akEditorMobileMaxWidth);
|
|
33
34
|
var toolbarButtonWrapperFullWith = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n"])));
|
|
34
35
|
var wrapper = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n"])));
|
|
35
|
-
var messages = (0, _reactIntlNext.defineMessages)({
|
|
36
|
-
findReplaceToolbarButton: {
|
|
37
|
-
id: 'fabric.editor.findReplaceToolbarButton',
|
|
38
|
-
defaultMessage: 'Find and replace',
|
|
39
|
-
description: '"Find" highlights all instances of a word or phrase on the document, and "Replace" changes one or all of those instances to something else'
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
36
|
var dropdownWidthNewDesign = 382;
|
|
43
37
|
var dropdownWidthOldDesign = 352;
|
|
44
38
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -94,7 +88,7 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
94
88
|
numMatches = _this$props.numMatches,
|
|
95
89
|
formatMessage = _this$props.intl.formatMessage,
|
|
96
90
|
takeFullWidth = _this$props.takeFullWidth;
|
|
97
|
-
var title = formatMessage(
|
|
91
|
+
var title = formatMessage(_messages.findReplaceMessages.findReplaceToolbarButton);
|
|
98
92
|
var stackBelowOtherEditorFloatingPanels = _editorSharedStyles.akEditorFloatingPanelZIndex - 1;
|
|
99
93
|
var keymap = (0, _keymaps.findKeymapByDescription)('Find');
|
|
100
94
|
return (0, _react2.jsx)("div", {
|
package/dist/cjs/ui/Replace.js
CHANGED
|
@@ -18,6 +18,7 @@ var _react2 = require("@emotion/react");
|
|
|
18
18
|
var _reactIntlNext = require("react-intl-next");
|
|
19
19
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
20
20
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
21
22
|
var _form = require("@atlaskit/form");
|
|
22
23
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-down"));
|
|
23
24
|
var _chevronUp = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-up"));
|
|
@@ -29,54 +30,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
29
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
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); }; }
|
|
31
32
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /** @jsx jsx */
|
|
32
|
-
var messages = (0, _reactIntlNext.defineMessages)({
|
|
33
|
-
replaceWith: {
|
|
34
|
-
id: 'fabric.editor.replaceWith',
|
|
35
|
-
defaultMessage: 'Replace with',
|
|
36
|
-
description: 'The value that will replace the word or phrase that was searched for'
|
|
37
|
-
},
|
|
38
|
-
replace: {
|
|
39
|
-
id: 'fabric.editor.replace',
|
|
40
|
-
defaultMessage: 'Replace',
|
|
41
|
-
description: 'Replace only the currently selected instance of the word or phrase'
|
|
42
|
-
},
|
|
43
|
-
replaceAll: {
|
|
44
|
-
id: 'fabric.editor.replaceAll',
|
|
45
|
-
defaultMessage: 'Replace all',
|
|
46
|
-
description: 'Replace all instances of the word or phrase throughout the entire document'
|
|
47
|
-
},
|
|
48
|
-
replaceSuccess: {
|
|
49
|
-
id: 'fabric.editor.replaceSuccess',
|
|
50
|
-
defaultMessage: '{numberOfMatches} {matchPluralSingularNoun} replaced',
|
|
51
|
-
description: 'Text when replacement succesfully done'
|
|
52
|
-
},
|
|
53
|
-
matchSingularNoun: {
|
|
54
|
-
id: 'fabric.editor.match.singular',
|
|
55
|
-
defaultMessage: 'match',
|
|
56
|
-
description: 'Singular "Match" noun'
|
|
57
|
-
},
|
|
58
|
-
matchPluralNoun: {
|
|
59
|
-
id: 'fabric.editor.match.plural',
|
|
60
|
-
defaultMessage: 'matches',
|
|
61
|
-
description: 'Plural "Match" noun'
|
|
62
|
-
},
|
|
63
|
-
findNext: {
|
|
64
|
-
id: 'fabric.editor.findNext',
|
|
65
|
-
defaultMessage: 'Find next',
|
|
66
|
-
description: 'Locate the next occurrence of the word or phrase that was searched for'
|
|
67
|
-
},
|
|
68
|
-
findPrevious: {
|
|
69
|
-
id: 'fabric.editor.findPrevious',
|
|
70
|
-
defaultMessage: 'Find previous',
|
|
71
|
-
description: 'Locate the previous occurrence of the word or phrase that was searched for'
|
|
72
|
-
},
|
|
73
|
-
closeFindReplaceDialog: {
|
|
74
|
-
id: 'fabric.editor.closeFindReplaceDialog',
|
|
75
|
-
defaultMessage: 'Close',
|
|
76
|
-
description: 'Cancel search and close the "Find and Replace" dialog'
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
33
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
81
34
|
var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
82
35
|
(0, _inherits2.default)(Replace, _React$PureComponent);
|
|
@@ -199,18 +152,18 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
199
152
|
fakeSuccessReplacementMessageUpdate: false,
|
|
200
153
|
replaceCount: 0
|
|
201
154
|
};
|
|
202
|
-
_this.replaceWith = formatMessage(
|
|
203
|
-
_this.replace = formatMessage(
|
|
204
|
-
_this.replaceAll = formatMessage(
|
|
205
|
-
_this.findNext = formatMessage(
|
|
206
|
-
_this.findPrevious = formatMessage(
|
|
155
|
+
_this.replaceWith = formatMessage(_messages.findReplaceMessages.replaceWith);
|
|
156
|
+
_this.replace = formatMessage(_messages.findReplaceMessages.replace);
|
|
157
|
+
_this.replaceAll = formatMessage(_messages.findReplaceMessages.replaceAll);
|
|
158
|
+
_this.findNext = formatMessage(_messages.findReplaceMessages.findNext);
|
|
159
|
+
_this.findPrevious = formatMessage(_messages.findReplaceMessages.findPrevious);
|
|
207
160
|
_this.findNextIcon = (0, _react2.jsx)(_chevronDown.default, {
|
|
208
161
|
label: _this.findNext
|
|
209
162
|
});
|
|
210
163
|
_this.findPrevIcon = (0, _react2.jsx)(_chevronUp.default, {
|
|
211
164
|
label: _this.findPrevious
|
|
212
165
|
});
|
|
213
|
-
_this.closeFindReplaceDialog = formatMessage(
|
|
166
|
+
_this.closeFindReplaceDialog = formatMessage(_messages.findReplaceMessages.closeFindReplaceDialog);
|
|
214
167
|
return _this;
|
|
215
168
|
}
|
|
216
169
|
(0, _createClass2.default)(Replace, [{
|
|
@@ -264,9 +217,9 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
264
217
|
canReplace = _this$props.canReplace,
|
|
265
218
|
count = _this$props.count,
|
|
266
219
|
formatMessage = _this$props.intl.formatMessage;
|
|
267
|
-
var resultsReplace = formatMessage(
|
|
220
|
+
var resultsReplace = formatMessage(_messages.findReplaceMessages.replaceSuccess, {
|
|
268
221
|
numberOfMatches: replaceCount,
|
|
269
|
-
matchPluralSingularNoun: replaceCount > 1 ? formatMessage(
|
|
222
|
+
matchPluralSingularNoun: replaceCount > 1 ? formatMessage(_messages.findReplaceMessages.matchPluralNoun) : formatMessage(_messages.findReplaceMessages.matchSingularNoun)
|
|
270
223
|
});
|
|
271
224
|
return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace') ? (0, _react2.jsx)(_react.Fragment, null, (0, _react2.jsx)("div", {
|
|
272
225
|
css: [_styles.sectionWrapperStyles, _styles.sectionWrapperStylesAlternate]
|
package/dist/es2019/ui/Find.js
CHANGED
|
@@ -5,8 +5,9 @@ import React from 'react';
|
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import debounce from 'lodash/debounce';
|
|
7
7
|
import rafSchd from 'raf-schd';
|
|
8
|
-
import {
|
|
8
|
+
import { injectIntl } from 'react-intl-next';
|
|
9
9
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
10
|
+
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
11
|
import { Label } from '@atlaskit/form';
|
|
11
12
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
12
13
|
import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
|
|
@@ -17,43 +18,6 @@ import Textfield from '@atlaskit/textfield';
|
|
|
17
18
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
18
19
|
import { afterInputSection, countStyles, countStylesAlternateStyles, countWrapperStyles, matchCaseSection, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
|
|
19
20
|
export const FIND_DEBOUNCE_MS = 100;
|
|
20
|
-
const messages = defineMessages({
|
|
21
|
-
find: {
|
|
22
|
-
id: 'fabric.editor.find',
|
|
23
|
-
defaultMessage: 'Find',
|
|
24
|
-
description: 'The word or phrase to search for on the document'
|
|
25
|
-
},
|
|
26
|
-
matchCase: {
|
|
27
|
-
id: 'fabric.editor.matchCase',
|
|
28
|
-
defaultMessage: 'Match case',
|
|
29
|
-
description: 'Toggle whether should also match case when searching for text'
|
|
30
|
-
},
|
|
31
|
-
findNext: {
|
|
32
|
-
id: 'fabric.editor.findNext',
|
|
33
|
-
defaultMessage: 'Find next',
|
|
34
|
-
description: 'Locate the next occurrence of the word or phrase that was searched for'
|
|
35
|
-
},
|
|
36
|
-
findPrevious: {
|
|
37
|
-
id: 'fabric.editor.findPrevious',
|
|
38
|
-
defaultMessage: 'Find previous',
|
|
39
|
-
description: 'Locate the previous occurrence of the word or phrase that was searched for'
|
|
40
|
-
},
|
|
41
|
-
closeFindReplaceDialog: {
|
|
42
|
-
id: 'fabric.editor.closeFindReplaceDialog',
|
|
43
|
-
defaultMessage: 'Close',
|
|
44
|
-
description: 'Cancel search and close the "Find and Replace" dialog'
|
|
45
|
-
},
|
|
46
|
-
noResultsFound: {
|
|
47
|
-
id: 'fabric.editor.noResultsFound',
|
|
48
|
-
defaultMessage: 'No results',
|
|
49
|
-
description: 'No matches were found for the word or phrase that was searched for'
|
|
50
|
-
},
|
|
51
|
-
resultsCount: {
|
|
52
|
-
id: 'fabric.editor.resultsCount',
|
|
53
|
-
description: 'Text for selected search match position and total results count',
|
|
54
|
-
defaultMessage: '{selectedMatchPosition} of {totalResultsCount}'
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
21
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
58
22
|
class Find extends React.Component {
|
|
59
23
|
constructor(props) {
|
|
@@ -4,9 +4,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { css, jsx } from '@emotion/react';
|
|
7
|
-
import {
|
|
7
|
+
import { injectIntl } from 'react-intl-next';
|
|
8
8
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { findKeymapByDescription, getAriaKeyshortcuts, tooltip, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
10
|
+
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
11
|
import { ArrowKeyNavigationType, Dropdown, TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
11
12
|
import { akEditorFloatingPanelZIndex, akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
12
13
|
import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
@@ -31,13 +32,6 @@ const wrapper = css`
|
|
|
31
32
|
display: flex;
|
|
32
33
|
flex-direction: column;
|
|
33
34
|
`;
|
|
34
|
-
const messages = defineMessages({
|
|
35
|
-
findReplaceToolbarButton: {
|
|
36
|
-
id: 'fabric.editor.findReplaceToolbarButton',
|
|
37
|
-
defaultMessage: 'Find and replace',
|
|
38
|
-
description: '"Find" highlights all instances of a word or phrase on the document, and "Replace" changes one or all of those instances to something else'
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
35
|
const dropdownWidthNewDesign = 382;
|
|
42
36
|
const dropdownWidthOldDesign = 352;
|
|
43
37
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
@@ -3,9 +3,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { Fragment } from 'react';
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
|
-
import {
|
|
6
|
+
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import Button from '@atlaskit/button/standard-button';
|
|
8
8
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
9
|
+
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
10
|
import { Label, ValidMessage } from '@atlaskit/form';
|
|
10
11
|
import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
|
|
11
12
|
import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
|
|
@@ -13,54 +14,6 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
13
14
|
import Textfield from '@atlaskit/textfield';
|
|
14
15
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
15
16
|
import { NextPreviousItem, orderOneStyles, orderZeroStyles, replaceSectionButtonStyles, sectionWrapperJustified, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
|
|
16
|
-
const messages = defineMessages({
|
|
17
|
-
replaceWith: {
|
|
18
|
-
id: 'fabric.editor.replaceWith',
|
|
19
|
-
defaultMessage: 'Replace with',
|
|
20
|
-
description: 'The value that will replace the word or phrase that was searched for'
|
|
21
|
-
},
|
|
22
|
-
replace: {
|
|
23
|
-
id: 'fabric.editor.replace',
|
|
24
|
-
defaultMessage: 'Replace',
|
|
25
|
-
description: 'Replace only the currently selected instance of the word or phrase'
|
|
26
|
-
},
|
|
27
|
-
replaceAll: {
|
|
28
|
-
id: 'fabric.editor.replaceAll',
|
|
29
|
-
defaultMessage: 'Replace all',
|
|
30
|
-
description: 'Replace all instances of the word or phrase throughout the entire document'
|
|
31
|
-
},
|
|
32
|
-
replaceSuccess: {
|
|
33
|
-
id: 'fabric.editor.replaceSuccess',
|
|
34
|
-
defaultMessage: '{numberOfMatches} {matchPluralSingularNoun} replaced',
|
|
35
|
-
description: 'Text when replacement succesfully done'
|
|
36
|
-
},
|
|
37
|
-
matchSingularNoun: {
|
|
38
|
-
id: 'fabric.editor.match.singular',
|
|
39
|
-
defaultMessage: 'match',
|
|
40
|
-
description: 'Singular "Match" noun'
|
|
41
|
-
},
|
|
42
|
-
matchPluralNoun: {
|
|
43
|
-
id: 'fabric.editor.match.plural',
|
|
44
|
-
defaultMessage: 'matches',
|
|
45
|
-
description: 'Plural "Match" noun'
|
|
46
|
-
},
|
|
47
|
-
findNext: {
|
|
48
|
-
id: 'fabric.editor.findNext',
|
|
49
|
-
defaultMessage: 'Find next',
|
|
50
|
-
description: 'Locate the next occurrence of the word or phrase that was searched for'
|
|
51
|
-
},
|
|
52
|
-
findPrevious: {
|
|
53
|
-
id: 'fabric.editor.findPrevious',
|
|
54
|
-
defaultMessage: 'Find previous',
|
|
55
|
-
description: 'Locate the previous occurrence of the word or phrase that was searched for'
|
|
56
|
-
},
|
|
57
|
-
closeFindReplaceDialog: {
|
|
58
|
-
id: 'fabric.editor.closeFindReplaceDialog',
|
|
59
|
-
defaultMessage: 'Close',
|
|
60
|
-
description: 'Cancel search and close the "Find and Replace" dialog'
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
17
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
65
18
|
class Replace extends React.PureComponent {
|
|
66
19
|
constructor(props) {
|
package/dist/esm/ui/Find.js
CHANGED
|
@@ -13,8 +13,9 @@ import React from 'react';
|
|
|
13
13
|
import { jsx } from '@emotion/react';
|
|
14
14
|
import debounce from 'lodash/debounce';
|
|
15
15
|
import rafSchd from 'raf-schd';
|
|
16
|
-
import {
|
|
16
|
+
import { injectIntl } from 'react-intl-next';
|
|
17
17
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
18
|
+
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
18
19
|
import { Label } from '@atlaskit/form';
|
|
19
20
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
20
21
|
import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
|
|
@@ -25,43 +26,6 @@ import Textfield from '@atlaskit/textfield';
|
|
|
25
26
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
26
27
|
import { afterInputSection, countStyles, countStylesAlternateStyles, countWrapperStyles, matchCaseSection, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
|
|
27
28
|
export var FIND_DEBOUNCE_MS = 100;
|
|
28
|
-
var messages = defineMessages({
|
|
29
|
-
find: {
|
|
30
|
-
id: 'fabric.editor.find',
|
|
31
|
-
defaultMessage: 'Find',
|
|
32
|
-
description: 'The word or phrase to search for on the document'
|
|
33
|
-
},
|
|
34
|
-
matchCase: {
|
|
35
|
-
id: 'fabric.editor.matchCase',
|
|
36
|
-
defaultMessage: 'Match case',
|
|
37
|
-
description: 'Toggle whether should also match case when searching for text'
|
|
38
|
-
},
|
|
39
|
-
findNext: {
|
|
40
|
-
id: 'fabric.editor.findNext',
|
|
41
|
-
defaultMessage: 'Find next',
|
|
42
|
-
description: 'Locate the next occurrence of the word or phrase that was searched for'
|
|
43
|
-
},
|
|
44
|
-
findPrevious: {
|
|
45
|
-
id: 'fabric.editor.findPrevious',
|
|
46
|
-
defaultMessage: 'Find previous',
|
|
47
|
-
description: 'Locate the previous occurrence of the word or phrase that was searched for'
|
|
48
|
-
},
|
|
49
|
-
closeFindReplaceDialog: {
|
|
50
|
-
id: 'fabric.editor.closeFindReplaceDialog',
|
|
51
|
-
defaultMessage: 'Close',
|
|
52
|
-
description: 'Cancel search and close the "Find and Replace" dialog'
|
|
53
|
-
},
|
|
54
|
-
noResultsFound: {
|
|
55
|
-
id: 'fabric.editor.noResultsFound',
|
|
56
|
-
defaultMessage: 'No results',
|
|
57
|
-
description: 'No matches were found for the word or phrase that was searched for'
|
|
58
|
-
},
|
|
59
|
-
resultsCount: {
|
|
60
|
-
id: 'fabric.editor.resultsCount',
|
|
61
|
-
description: 'Text for selected search match position and total results count',
|
|
62
|
-
defaultMessage: '{selectedMatchPosition} of {totalResultsCount}'
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
29
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
66
30
|
var Find = /*#__PURE__*/function (_React$Component) {
|
|
67
31
|
_inherits(Find, _React$Component);
|
|
@@ -14,9 +14,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
14
14
|
/** @jsx jsx */
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import { css, jsx } from '@emotion/react';
|
|
17
|
-
import {
|
|
17
|
+
import { injectIntl } from 'react-intl-next';
|
|
18
18
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
19
19
|
import { findKeymapByDescription, getAriaKeyshortcuts, tooltip, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
20
|
+
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
20
21
|
import { ArrowKeyNavigationType, Dropdown, TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
21
22
|
import { akEditorFloatingPanelZIndex, akEditorMobileMaxWidth } from '@atlaskit/editor-shared-styles';
|
|
22
23
|
import EditorSearchIcon from '@atlaskit/icon/glyph/editor/search';
|
|
@@ -25,13 +26,6 @@ import FindReplace from './FindReplace';
|
|
|
25
26
|
var toolbarButtonWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex: 1 1 auto;\n flex-grow: 0;\n justify-content: flex-end;\n align-items: center;\n padding: 0 ", ";\n @media (max-width: ", "px) {\n justify-content: center;\n padding: 0;\n }\n"])), "var(--ds-space-100, 8px)", akEditorMobileMaxWidth);
|
|
26
27
|
var toolbarButtonWrapperFullWith = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex-grow: 1;\n"])));
|
|
27
28
|
var wrapper = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n"])));
|
|
28
|
-
var messages = defineMessages({
|
|
29
|
-
findReplaceToolbarButton: {
|
|
30
|
-
id: 'fabric.editor.findReplaceToolbarButton',
|
|
31
|
-
defaultMessage: 'Find and replace',
|
|
32
|
-
description: '"Find" highlights all instances of a word or phrase on the document, and "Replace" changes one or all of those instances to something else'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
29
|
var dropdownWidthNewDesign = 382;
|
|
36
30
|
var dropdownWidthOldDesign = 352;
|
|
37
31
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
package/dist/esm/ui/Replace.js
CHANGED
|
@@ -11,9 +11,10 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
11
11
|
/** @jsx jsx */
|
|
12
12
|
import React, { Fragment } from 'react';
|
|
13
13
|
import { jsx } from '@emotion/react';
|
|
14
|
-
import {
|
|
14
|
+
import { injectIntl } from 'react-intl-next';
|
|
15
15
|
import Button from '@atlaskit/button/standard-button';
|
|
16
16
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
17
|
+
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
17
18
|
import { Label, ValidMessage } from '@atlaskit/form';
|
|
18
19
|
import ChevronDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-down';
|
|
19
20
|
import ChevronUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-up';
|
|
@@ -21,54 +22,6 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
21
22
|
import Textfield from '@atlaskit/textfield';
|
|
22
23
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
23
24
|
import { NextPreviousItem, orderOneStyles, orderZeroStyles, replaceSectionButtonStyles, sectionWrapperJustified, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
|
|
24
|
-
var messages = defineMessages({
|
|
25
|
-
replaceWith: {
|
|
26
|
-
id: 'fabric.editor.replaceWith',
|
|
27
|
-
defaultMessage: 'Replace with',
|
|
28
|
-
description: 'The value that will replace the word or phrase that was searched for'
|
|
29
|
-
},
|
|
30
|
-
replace: {
|
|
31
|
-
id: 'fabric.editor.replace',
|
|
32
|
-
defaultMessage: 'Replace',
|
|
33
|
-
description: 'Replace only the currently selected instance of the word or phrase'
|
|
34
|
-
},
|
|
35
|
-
replaceAll: {
|
|
36
|
-
id: 'fabric.editor.replaceAll',
|
|
37
|
-
defaultMessage: 'Replace all',
|
|
38
|
-
description: 'Replace all instances of the word or phrase throughout the entire document'
|
|
39
|
-
},
|
|
40
|
-
replaceSuccess: {
|
|
41
|
-
id: 'fabric.editor.replaceSuccess',
|
|
42
|
-
defaultMessage: '{numberOfMatches} {matchPluralSingularNoun} replaced',
|
|
43
|
-
description: 'Text when replacement succesfully done'
|
|
44
|
-
},
|
|
45
|
-
matchSingularNoun: {
|
|
46
|
-
id: 'fabric.editor.match.singular',
|
|
47
|
-
defaultMessage: 'match',
|
|
48
|
-
description: 'Singular "Match" noun'
|
|
49
|
-
},
|
|
50
|
-
matchPluralNoun: {
|
|
51
|
-
id: 'fabric.editor.match.plural',
|
|
52
|
-
defaultMessage: 'matches',
|
|
53
|
-
description: 'Plural "Match" noun'
|
|
54
|
-
},
|
|
55
|
-
findNext: {
|
|
56
|
-
id: 'fabric.editor.findNext',
|
|
57
|
-
defaultMessage: 'Find next',
|
|
58
|
-
description: 'Locate the next occurrence of the word or phrase that was searched for'
|
|
59
|
-
},
|
|
60
|
-
findPrevious: {
|
|
61
|
-
id: 'fabric.editor.findPrevious',
|
|
62
|
-
defaultMessage: 'Find previous',
|
|
63
|
-
description: 'Locate the previous occurrence of the word or phrase that was searched for'
|
|
64
|
-
},
|
|
65
|
-
closeFindReplaceDialog: {
|
|
66
|
-
id: 'fabric.editor.closeFindReplaceDialog',
|
|
67
|
-
defaultMessage: 'Close',
|
|
68
|
-
description: 'Cancel search and close the "Find and Replace" dialog'
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
25
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
73
26
|
var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
74
27
|
_inherits(Replace, _React$PureComponent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-find-replace",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "find replace plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@atlaskit/button": "^17.3.0",
|
|
38
|
-
"@atlaskit/editor-common": "^77.
|
|
38
|
+
"@atlaskit/editor-common": "^77.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
40
40
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "1.1.0",
|