@atlaskit/editor-plugin-find-replace 2.3.1 → 2.4.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 +19 -0
- package/dist/cjs/pm-plugins/commands.js +7 -0
- package/dist/cjs/ui/FindReplace.js +3 -2
- package/dist/cjs/ui/FindReplaceDropDownOrToolbarButtonWithState.js +6 -1
- package/dist/cjs/ui/FindReplaceDropdown.js +3 -1
- package/dist/cjs/ui/FindReplaceToolbarButton.js +3 -1
- package/dist/cjs/ui/Replace.js +27 -9
- package/dist/cjs/ui/ReplaceNext.js +23 -7
- package/dist/es2019/pm-plugins/commands.js +7 -0
- package/dist/es2019/ui/FindReplace.js +3 -2
- package/dist/es2019/ui/FindReplaceDropDownOrToolbarButtonWithState.js +4 -1
- package/dist/es2019/ui/FindReplaceDropdown.js +3 -1
- package/dist/es2019/ui/FindReplaceToolbarButton.js +3 -1
- package/dist/es2019/ui/Replace.js +23 -9
- package/dist/es2019/ui/ReplaceNext.js +19 -7
- package/dist/esm/pm-plugins/commands.js +7 -0
- package/dist/esm/ui/FindReplace.js +3 -2
- package/dist/esm/ui/FindReplaceDropDownOrToolbarButtonWithState.js +6 -1
- package/dist/esm/ui/FindReplaceDropdown.js +3 -1
- package/dist/esm/ui/FindReplaceToolbarButton.js +3 -1
- package/dist/esm/ui/Replace.js +27 -9
- package/dist/esm/ui/ReplaceNext.js +23 -7
- package/dist/types/ui/FindReplace.d.ts +2 -0
- package/dist/types/ui/FindReplaceDropdown.d.ts +2 -0
- package/dist/types/ui/FindReplaceToolbarButton.d.ts +1 -0
- package/dist/types/ui/Replace.d.ts +1 -0
- package/dist/types/ui/ReplaceNext.d.ts +1 -0
- package/dist/types-ts4.5/ui/FindReplace.d.ts +2 -0
- package/dist/types-ts4.5/ui/FindReplaceDropdown.d.ts +2 -0
- package/dist/types-ts4.5/ui/FindReplaceToolbarButton.d.ts +1 -0
- package/dist/types-ts4.5/ui/Replace.d.ts +1 -0
- package/dist/types-ts4.5/ui/ReplaceNext.d.ts +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-find-replace
|
|
2
2
|
|
|
3
|
+
## 2.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#167734](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/167734)
|
|
14
|
+
[`74e7440fe9307`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/74e7440fe9307) -
|
|
15
|
+
[ux] [ED-27959] this change is disabling the Replace/ Replace All functionality for non-text
|
|
16
|
+
matches with the platform_editor_find_and_replace_1 flag enabled
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 2.3.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.toggleMatchCase = exports.replaceAll = exports.replace = exports.removeDecorations = exports.findPrevious = exports.findNext = exports.find = exports.cancelSearch = exports.blur = exports.addDecorations = exports.activate = void 0;
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
11
|
var _actions = require("./actions");
|
|
11
12
|
var _pluginFactory = require("./plugin-factory");
|
|
12
13
|
var _utils = require("./utils");
|
|
@@ -153,6 +154,9 @@ var replace = exports.replace = function replace(replaceText) {
|
|
|
153
154
|
index = _getPluginState6.index,
|
|
154
155
|
findText = _getPluginState6.findText;
|
|
155
156
|
if (matches[index]) {
|
|
157
|
+
if (!matches[index].canReplace && (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1')) {
|
|
158
|
+
return tr;
|
|
159
|
+
}
|
|
156
160
|
var _matches$index = matches[index],
|
|
157
161
|
start = _matches$index.start,
|
|
158
162
|
end = _matches$index.end;
|
|
@@ -172,6 +176,9 @@ var replaceAll = exports.replaceAll = function replaceAll(replaceText) {
|
|
|
172
176
|
}, function (tr, state) {
|
|
173
177
|
var pluginState = (0, _pluginFactory.getPluginState)(state);
|
|
174
178
|
pluginState.matches.forEach(function (match) {
|
|
179
|
+
if (!match.canReplace && (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1')) {
|
|
180
|
+
return tr;
|
|
181
|
+
}
|
|
175
182
|
tr.insertText(replaceText, tr.mapping.map(match.start), tr.mapping.map(match.end));
|
|
176
183
|
});
|
|
177
184
|
tr.setMeta('scrollIntoView', false);
|
|
@@ -107,6 +107,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
107
107
|
var _this$props = this.props,
|
|
108
108
|
findText = _this$props.findText,
|
|
109
109
|
count = _this$props.count,
|
|
110
|
+
isReplaceable = _this$props.isReplaceable,
|
|
110
111
|
shouldFocus = _this$props.shouldFocus,
|
|
111
112
|
onFind = _this$props.onFind,
|
|
112
113
|
onFindBlur = _this$props.onFindBlur,
|
|
@@ -147,7 +148,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
147
148
|
css: _uiStyles.ruleStyles,
|
|
148
149
|
id: "replace-hr-element"
|
|
149
150
|
}), (0, _platformFeatureFlags.fg)('editor_a11y_refactor_find_replace_style') ? (0, _react2.jsx)(_ReplaceNext.default, {
|
|
150
|
-
canReplace: count.total > 0,
|
|
151
|
+
canReplace: (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1') ? !!isReplaceable : count.total > 0,
|
|
151
152
|
replaceText: replaceText,
|
|
152
153
|
onReplace: onReplace,
|
|
153
154
|
onReplaceAll: onReplaceAll,
|
|
@@ -162,7 +163,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
162
163
|
setFindTyped: this.setFindTyped,
|
|
163
164
|
focusToolbarButton: focusToolbarButton
|
|
164
165
|
}) : (0, _react2.jsx)(_Replace.default, {
|
|
165
|
-
canReplace: count.total > 0,
|
|
166
|
+
canReplace: (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1') ? !!isReplaceable : count.total > 0,
|
|
166
167
|
replaceText: replaceText,
|
|
167
168
|
onReplace: onReplace,
|
|
168
169
|
onReplaceAll: onReplaceAll,
|
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _commands = require("../pm-plugins/commands");
|
|
14
15
|
var _commandsWithAnalytics = require("../pm-plugins/commands-with-analytics");
|
|
15
16
|
var _FindReplaceDropdown = _interopRequireDefault(require("./FindReplaceDropdown"));
|
|
@@ -72,7 +73,7 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
|
|
|
72
73
|
};
|
|
73
74
|
});
|
|
74
75
|
var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithState(_ref2) {
|
|
75
|
-
var _api$analytics;
|
|
76
|
+
var _api$analytics, _matches$index;
|
|
76
77
|
var popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
77
78
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
78
79
|
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
@@ -185,6 +186,10 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
|
|
|
185
186
|
findText: findText,
|
|
186
187
|
index: index,
|
|
187
188
|
numMatches: matches.length,
|
|
189
|
+
isReplaceable: (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1') ? (_matches$index = matches[index]) === null || _matches$index === void 0 ? void 0 : _matches$index.canReplace : undefined,
|
|
190
|
+
numReplaceable: (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1') ? matches.filter(function (match) {
|
|
191
|
+
return match.canReplace === true;
|
|
192
|
+
}).length : undefined,
|
|
188
193
|
replaceText: replaceText,
|
|
189
194
|
shouldFocus: shouldFocus,
|
|
190
195
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
@@ -27,6 +27,7 @@ var FindReplaceDropdown = function FindReplaceDropdown(props) {
|
|
|
27
27
|
index = props.index,
|
|
28
28
|
numMatches = props.numMatches,
|
|
29
29
|
popupsMountPoint = props.popupsMountPoint,
|
|
30
|
+
numReplaceable = props.numReplaceable,
|
|
30
31
|
onCancel = props.onCancel;
|
|
31
32
|
if (!popupsMountPoint) {
|
|
32
33
|
return null;
|
|
@@ -59,7 +60,8 @@ var FindReplaceDropdown = function FindReplaceDropdown(props) {
|
|
|
59
60
|
replaceText: replaceText,
|
|
60
61
|
count: {
|
|
61
62
|
index: index,
|
|
62
|
-
total: numMatches
|
|
63
|
+
total: numMatches,
|
|
64
|
+
totalReplaceable: numReplaceable
|
|
63
65
|
}
|
|
64
66
|
// Ignored via go/ees005
|
|
65
67
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -106,6 +106,7 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
106
106
|
isActive = _this$props.isActive,
|
|
107
107
|
index = _this$props.index,
|
|
108
108
|
numMatches = _this$props.numMatches,
|
|
109
|
+
numReplaceable = _this$props.numReplaceable,
|
|
109
110
|
formatMessage = _this$props.intl.formatMessage,
|
|
110
111
|
takeFullWidth = _this$props.takeFullWidth,
|
|
111
112
|
_this$props$isButtonH = _this$props.isButtonHidden,
|
|
@@ -187,7 +188,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
187
188
|
replaceText: replaceText,
|
|
188
189
|
count: {
|
|
189
190
|
index: index,
|
|
190
|
-
total: numMatches
|
|
191
|
+
total: numMatches,
|
|
192
|
+
totalReplaceable: numReplaceable
|
|
191
193
|
},
|
|
192
194
|
focusToolbarButton: this.focusToolbarButton
|
|
193
195
|
// Ignored via go/ees005
|
package/dist/cjs/ui/Replace.js
CHANGED
|
@@ -19,8 +19,9 @@ var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
|
19
19
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
20
20
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
21
21
|
var _form = require("@atlaskit/form");
|
|
22
|
-
var _chevronDownHipchatChevronDown = _interopRequireDefault(require("@atlaskit/icon/
|
|
23
|
-
var _chevronUpHipchatChevronUp = _interopRequireDefault(require("@atlaskit/icon/
|
|
22
|
+
var _chevronDownHipchatChevronDown = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-down--hipchat-chevron-down"));
|
|
23
|
+
var _chevronUpHipchatChevronUp = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-up--hipchat-chevron-up"));
|
|
24
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
25
|
var _primitives = require("@atlaskit/primitives");
|
|
25
26
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
26
27
|
var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
|
|
@@ -101,10 +102,17 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
102
|
_this.setState({
|
|
102
103
|
isHelperMessageVisible: true
|
|
103
104
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
if (_this.props.count.totalReplaceable && (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1')) {
|
|
106
|
+
_this.triggerSuccessReplacementMessageUpdate(_this.props.count.totalReplaceable);
|
|
107
|
+
_this.setState({
|
|
108
|
+
replaceCount: _this.props.count.totalReplaceable
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
_this.triggerSuccessReplacementMessageUpdate(_this.props.count.total);
|
|
112
|
+
_this.setState({
|
|
113
|
+
replaceCount: _this.props.count.total
|
|
114
|
+
});
|
|
115
|
+
}
|
|
108
116
|
_this.props.setFindTyped(false);
|
|
109
117
|
});
|
|
110
118
|
});
|
|
@@ -250,7 +258,12 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
250
258
|
css: _uiStyles.nextPreviousItemStyles
|
|
251
259
|
}, (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
252
260
|
title: this.findNext,
|
|
253
|
-
icon:
|
|
261
|
+
icon: function icon(iconProps) {
|
|
262
|
+
return (0, _react2.jsx)(_chevronDownHipchatChevronDown.default, {
|
|
263
|
+
label: iconProps.label,
|
|
264
|
+
size: "small"
|
|
265
|
+
});
|
|
266
|
+
},
|
|
254
267
|
iconLabel: this.findNext,
|
|
255
268
|
keymapDescription: 'Enter',
|
|
256
269
|
onClick: this.handleFindNextClick,
|
|
@@ -259,7 +272,12 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
259
272
|
css: _uiStyles.nextPreviousItemStyles
|
|
260
273
|
}, (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
261
274
|
title: this.findPrevious,
|
|
262
|
-
icon:
|
|
275
|
+
icon: function icon(iconProps) {
|
|
276
|
+
return (0, _react2.jsx)(_chevronUpHipchatChevronUp.default, {
|
|
277
|
+
label: iconProps.label,
|
|
278
|
+
size: "small"
|
|
279
|
+
});
|
|
280
|
+
},
|
|
263
281
|
iconLabel: this.findPrevious,
|
|
264
282
|
keymapDescription: 'Shift Enter',
|
|
265
283
|
onClick: this.handleFindPrevClick,
|
|
@@ -284,7 +302,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
284
302
|
testId: this.replaceAll,
|
|
285
303
|
id: "replaceAll-button",
|
|
286
304
|
onClick: this.handleReplaceAllClick,
|
|
287
|
-
isDisabled: !canReplace
|
|
305
|
+
isDisabled: (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1') ? count.totalReplaceable === 0 : !canReplace
|
|
288
306
|
}, this.replaceAll))), (0, _react2.jsx)("div", {
|
|
289
307
|
css: _uiStyles.orderZeroStyles
|
|
290
308
|
}, (0, _react2.jsx)(_new.default, {
|
|
@@ -13,8 +13,9 @@ var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
14
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
15
15
|
var _form = require("@atlaskit/form");
|
|
16
|
-
var _chevronDownHipchatChevronDown = _interopRequireDefault(require("@atlaskit/icon/
|
|
17
|
-
var _chevronUpHipchatChevronUp = _interopRequireDefault(require("@atlaskit/icon/
|
|
16
|
+
var _chevronDownHipchatChevronDown = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-down--hipchat-chevron-down"));
|
|
17
|
+
var _chevronUpHipchatChevronUp = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-up--hipchat-chevron-up"));
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _primitives = require("@atlaskit/primitives");
|
|
19
20
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
20
21
|
var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
|
|
@@ -143,8 +144,13 @@ var Replace = function Replace(_ref) {
|
|
|
143
144
|
replaceText: replaceText
|
|
144
145
|
});
|
|
145
146
|
setIsHelperMessageVisible(true);
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
if (count.totalReplaceable && (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1')) {
|
|
148
|
+
triggerSuccessReplacementMessageUpdate(count.totalReplaceable);
|
|
149
|
+
setReplaceCount(count.totalReplaceable);
|
|
150
|
+
} else {
|
|
151
|
+
triggerSuccessReplacementMessageUpdate(count.total);
|
|
152
|
+
setReplaceCount(count.total);
|
|
153
|
+
}
|
|
148
154
|
setFindTyped(false);
|
|
149
155
|
});
|
|
150
156
|
};
|
|
@@ -211,14 +217,24 @@ var Replace = function Replace(_ref) {
|
|
|
211
217
|
xcss: actionButtonInlineStyles
|
|
212
218
|
}, /*#__PURE__*/_react.default.createElement(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
213
219
|
title: formatMessage(_messages.findReplaceMessages.findNext),
|
|
214
|
-
icon:
|
|
220
|
+
icon: function icon(iconProps) {
|
|
221
|
+
return /*#__PURE__*/_react.default.createElement(_chevronDownHipchatChevronDown.default, {
|
|
222
|
+
label: iconProps.label,
|
|
223
|
+
size: "small"
|
|
224
|
+
});
|
|
225
|
+
},
|
|
215
226
|
iconLabel: formatMessage(_messages.findReplaceMessages.findNext),
|
|
216
227
|
keymapDescription: 'Enter',
|
|
217
228
|
onClick: handleFindNextClick,
|
|
218
229
|
disabled: count.total <= 1
|
|
219
230
|
}), /*#__PURE__*/_react.default.createElement(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
|
|
220
231
|
title: findPrevious,
|
|
221
|
-
icon:
|
|
232
|
+
icon: function icon(iconProps) {
|
|
233
|
+
return /*#__PURE__*/_react.default.createElement(_chevronUpHipchatChevronUp.default, {
|
|
234
|
+
label: iconProps.label,
|
|
235
|
+
size: "small"
|
|
236
|
+
});
|
|
237
|
+
},
|
|
222
238
|
iconLabel: findPrevious,
|
|
223
239
|
keymapDescription: 'Shift Enter',
|
|
224
240
|
onClick: handleFindPrevClick,
|
|
@@ -233,7 +249,7 @@ var Replace = function Replace(_ref) {
|
|
|
233
249
|
testId: replaceAll,
|
|
234
250
|
id: "replaceAll-button",
|
|
235
251
|
onClick: handleReplaceAllClick,
|
|
236
|
-
isDisabled: !canReplace
|
|
252
|
+
isDisabled: (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1') ? count.totalReplaceable === 0 : !canReplace
|
|
237
253
|
}, replaceAll)), /*#__PURE__*/_react.default.createElement(_new.default, {
|
|
238
254
|
appearance: "subtle",
|
|
239
255
|
testId: closeFindReplaceDialog,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { FindReplaceActionTypes } from './actions';
|
|
4
5
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
5
6
|
import { createDecoration, findDecorationFromMatch, findMatches, findSearchIndex, getSelectedText, getSelectionForMatch, nextIndex, prevIndex, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
@@ -149,6 +150,9 @@ export const replace = replaceText => withScrollIntoView(createCommand(state =>
|
|
|
149
150
|
findText
|
|
150
151
|
} = getPluginState(state);
|
|
151
152
|
if (matches[index]) {
|
|
153
|
+
if (!matches[index].canReplace && fg('platform_editor_find_and_replace_1')) {
|
|
154
|
+
return tr;
|
|
155
|
+
}
|
|
152
156
|
const {
|
|
153
157
|
start,
|
|
154
158
|
end
|
|
@@ -167,6 +171,9 @@ export const replaceAll = replaceText => createCommand({
|
|
|
167
171
|
}, (tr, state) => {
|
|
168
172
|
const pluginState = getPluginState(state);
|
|
169
173
|
pluginState.matches.forEach(match => {
|
|
174
|
+
if (!match.canReplace && fg('platform_editor_find_and_replace_1')) {
|
|
175
|
+
return tr;
|
|
176
|
+
}
|
|
170
177
|
tr.insertText(replaceText, tr.mapping.map(match.start), tr.mapping.map(match.end));
|
|
171
178
|
});
|
|
172
179
|
tr.setMeta('scrollIntoView', false);
|
|
@@ -84,6 +84,7 @@ class FindReplace extends React.PureComponent {
|
|
|
84
84
|
const {
|
|
85
85
|
findText,
|
|
86
86
|
count,
|
|
87
|
+
isReplaceable,
|
|
87
88
|
shouldFocus,
|
|
88
89
|
onFind,
|
|
89
90
|
onFindBlur,
|
|
@@ -125,7 +126,7 @@ class FindReplace extends React.PureComponent {
|
|
|
125
126
|
css: ruleStyles,
|
|
126
127
|
id: "replace-hr-element"
|
|
127
128
|
}), fg('editor_a11y_refactor_find_replace_style') ? jsx(ReplaceNext, {
|
|
128
|
-
canReplace: count.total > 0,
|
|
129
|
+
canReplace: fg('platform_editor_find_and_replace_1') ? !!isReplaceable : count.total > 0,
|
|
129
130
|
replaceText: replaceText,
|
|
130
131
|
onReplace: onReplace,
|
|
131
132
|
onReplaceAll: onReplaceAll,
|
|
@@ -140,7 +141,7 @@ class FindReplace extends React.PureComponent {
|
|
|
140
141
|
setFindTyped: this.setFindTyped,
|
|
141
142
|
focusToolbarButton: focusToolbarButton
|
|
142
143
|
}) : jsx(Replace, {
|
|
143
|
-
canReplace: count.total > 0,
|
|
144
|
+
canReplace: fg('platform_editor_find_and_replace_1') ? !!isReplaceable : count.total > 0,
|
|
144
145
|
replaceText: replaceText,
|
|
145
146
|
onReplace: onReplace,
|
|
146
147
|
onReplaceAll: onReplaceAll,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useLayoutEffect, useState } from 'react';
|
|
2
2
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { blur, toggleMatchCase } from '../pm-plugins/commands';
|
|
5
6
|
import { activateWithAnalytics, cancelSearchWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, findWithAnalytics, replaceAllWithAnalytics, replaceWithAnalytics } from '../pm-plugins/commands-with-analytics';
|
|
6
7
|
import FindReplaceDropdown from './FindReplaceDropdown';
|
|
@@ -74,7 +75,7 @@ const FindReplaceToolbarButtonWithState = ({
|
|
|
74
75
|
isButtonHidden,
|
|
75
76
|
doesNotHaveButton
|
|
76
77
|
}) => {
|
|
77
|
-
var _api$analytics;
|
|
78
|
+
var _api$analytics, _matches$index;
|
|
78
79
|
const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
79
80
|
const {
|
|
80
81
|
shouldMatchCase,
|
|
@@ -172,6 +173,8 @@ const FindReplaceToolbarButtonWithState = ({
|
|
|
172
173
|
findText: findText,
|
|
173
174
|
index: index,
|
|
174
175
|
numMatches: matches.length,
|
|
176
|
+
isReplaceable: fg('platform_editor_find_and_replace_1') ? (_matches$index = matches[index]) === null || _matches$index === void 0 ? void 0 : _matches$index.canReplace : undefined,
|
|
177
|
+
numReplaceable: fg('platform_editor_find_and_replace_1') ? matches.filter(match => match.canReplace === true).length : undefined,
|
|
175
178
|
replaceText: replaceText,
|
|
176
179
|
shouldFocus: shouldFocus,
|
|
177
180
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
@@ -21,6 +21,7 @@ const FindReplaceDropdown = props => {
|
|
|
21
21
|
index,
|
|
22
22
|
numMatches,
|
|
23
23
|
popupsMountPoint,
|
|
24
|
+
numReplaceable,
|
|
24
25
|
onCancel
|
|
25
26
|
} = props;
|
|
26
27
|
if (!popupsMountPoint) {
|
|
@@ -54,7 +55,8 @@ const FindReplaceDropdown = props => {
|
|
|
54
55
|
replaceText: replaceText,
|
|
55
56
|
count: {
|
|
56
57
|
index,
|
|
57
|
-
total: numMatches
|
|
58
|
+
total: numMatches,
|
|
59
|
+
totalReplaceable: numReplaceable
|
|
58
60
|
}
|
|
59
61
|
// Ignored via go/ees005
|
|
60
62
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -94,6 +94,7 @@ class FindReplaceToolbarButton extends React.PureComponent {
|
|
|
94
94
|
isActive,
|
|
95
95
|
index,
|
|
96
96
|
numMatches,
|
|
97
|
+
numReplaceable,
|
|
97
98
|
intl: {
|
|
98
99
|
formatMessage
|
|
99
100
|
},
|
|
@@ -177,7 +178,8 @@ class FindReplaceToolbarButton extends React.PureComponent {
|
|
|
177
178
|
replaceText: replaceText,
|
|
178
179
|
count: {
|
|
179
180
|
index,
|
|
180
|
-
total: numMatches
|
|
181
|
+
total: numMatches,
|
|
182
|
+
totalReplaceable: numReplaceable
|
|
181
183
|
},
|
|
182
184
|
focusToolbarButton: this.focusToolbarButton
|
|
183
185
|
// Ignored via go/ees005
|
|
@@ -13,8 +13,9 @@ import Button from '@atlaskit/button/new';
|
|
|
13
13
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
14
14
|
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { Label, ValidMessage } from '@atlaskit/form';
|
|
16
|
-
import ChevronDownIcon from '@atlaskit/icon/
|
|
17
|
-
import ChevronUpIcon from '@atlaskit/icon/
|
|
16
|
+
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down--hipchat-chevron-down';
|
|
17
|
+
import ChevronUpIcon from '@atlaskit/icon/core/migration/chevron-up--hipchat-chevron-up';
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
19
|
import { Inline, xcss } from '@atlaskit/primitives';
|
|
19
20
|
import Textfield from '@atlaskit/textfield';
|
|
20
21
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
@@ -82,10 +83,17 @@ class Replace extends React.PureComponent {
|
|
|
82
83
|
this.setState({
|
|
83
84
|
isHelperMessageVisible: true
|
|
84
85
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
if (this.props.count.totalReplaceable && fg('platform_editor_find_and_replace_1')) {
|
|
87
|
+
this.triggerSuccessReplacementMessageUpdate(this.props.count.totalReplaceable);
|
|
88
|
+
this.setState({
|
|
89
|
+
replaceCount: this.props.count.totalReplaceable
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
this.triggerSuccessReplacementMessageUpdate(this.props.count.total);
|
|
93
|
+
this.setState({
|
|
94
|
+
replaceCount: this.props.count.total
|
|
95
|
+
});
|
|
96
|
+
}
|
|
89
97
|
this.props.setFindTyped(false);
|
|
90
98
|
}));
|
|
91
99
|
_defineProperty(this, "handleCompositionStart", () => {
|
|
@@ -231,7 +239,10 @@ class Replace extends React.PureComponent {
|
|
|
231
239
|
css: nextPreviousItemStyles
|
|
232
240
|
}, jsx(FindReplaceTooltipButton, {
|
|
233
241
|
title: this.findNext,
|
|
234
|
-
icon: ChevronDownIcon,
|
|
242
|
+
icon: iconProps => jsx(ChevronDownIcon, {
|
|
243
|
+
label: iconProps.label,
|
|
244
|
+
size: "small"
|
|
245
|
+
}),
|
|
235
246
|
iconLabel: this.findNext,
|
|
236
247
|
keymapDescription: 'Enter',
|
|
237
248
|
onClick: this.handleFindNextClick,
|
|
@@ -240,7 +251,10 @@ class Replace extends React.PureComponent {
|
|
|
240
251
|
css: nextPreviousItemStyles
|
|
241
252
|
}, jsx(FindReplaceTooltipButton, {
|
|
242
253
|
title: this.findPrevious,
|
|
243
|
-
icon: ChevronUpIcon,
|
|
254
|
+
icon: iconProps => jsx(ChevronUpIcon, {
|
|
255
|
+
label: iconProps.label,
|
|
256
|
+
size: "small"
|
|
257
|
+
}),
|
|
244
258
|
iconLabel: this.findPrevious,
|
|
245
259
|
keymapDescription: 'Shift Enter',
|
|
246
260
|
onClick: this.handleFindPrevClick,
|
|
@@ -265,7 +279,7 @@ class Replace extends React.PureComponent {
|
|
|
265
279
|
testId: this.replaceAll,
|
|
266
280
|
id: "replaceAll-button",
|
|
267
281
|
onClick: this.handleReplaceAllClick,
|
|
268
|
-
isDisabled: !canReplace
|
|
282
|
+
isDisabled: fg('platform_editor_find_and_replace_1') ? count.totalReplaceable === 0 : !canReplace
|
|
269
283
|
}, this.replaceAll))), jsx("div", {
|
|
270
284
|
css: orderZeroStyles
|
|
271
285
|
}, jsx(Button, {
|
|
@@ -4,8 +4,9 @@ import Button from '@atlaskit/button/new';
|
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { ValidMessage } from '@atlaskit/form';
|
|
7
|
-
import ChevronDownIcon from '@atlaskit/icon/
|
|
8
|
-
import ChevronUpIcon from '@atlaskit/icon/
|
|
7
|
+
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down--hipchat-chevron-down';
|
|
8
|
+
import ChevronUpIcon from '@atlaskit/icon/core/migration/chevron-up--hipchat-chevron-up';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { Box, Inline, Text, xcss } from '@atlaskit/primitives';
|
|
10
11
|
import Textfield from '@atlaskit/textfield';
|
|
11
12
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
@@ -114,8 +115,13 @@ const Replace = ({
|
|
|
114
115
|
replaceText
|
|
115
116
|
});
|
|
116
117
|
setIsHelperMessageVisible(true);
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
if (count.totalReplaceable && fg('platform_editor_find_and_replace_1')) {
|
|
119
|
+
triggerSuccessReplacementMessageUpdate(count.totalReplaceable);
|
|
120
|
+
setReplaceCount(count.totalReplaceable);
|
|
121
|
+
} else {
|
|
122
|
+
triggerSuccessReplacementMessageUpdate(count.total);
|
|
123
|
+
setReplaceCount(count.total);
|
|
124
|
+
}
|
|
119
125
|
setFindTyped(false);
|
|
120
126
|
});
|
|
121
127
|
const handleCompositionStart = () => {
|
|
@@ -181,14 +187,20 @@ const Replace = ({
|
|
|
181
187
|
xcss: actionButtonInlineStyles
|
|
182
188
|
}, /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
|
|
183
189
|
title: formatMessage(messages.findNext),
|
|
184
|
-
icon: ChevronDownIcon,
|
|
190
|
+
icon: iconProps => /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
191
|
+
label: iconProps.label,
|
|
192
|
+
size: "small"
|
|
193
|
+
}),
|
|
185
194
|
iconLabel: formatMessage(messages.findNext),
|
|
186
195
|
keymapDescription: 'Enter',
|
|
187
196
|
onClick: handleFindNextClick,
|
|
188
197
|
disabled: count.total <= 1
|
|
189
198
|
}), /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
|
|
190
199
|
title: findPrevious,
|
|
191
|
-
icon: ChevronUpIcon,
|
|
200
|
+
icon: iconProps => /*#__PURE__*/React.createElement(ChevronUpIcon, {
|
|
201
|
+
label: iconProps.label,
|
|
202
|
+
size: "small"
|
|
203
|
+
}),
|
|
192
204
|
iconLabel: findPrevious,
|
|
193
205
|
keymapDescription: 'Shift Enter',
|
|
194
206
|
onClick: handleFindPrevClick,
|
|
@@ -203,7 +215,7 @@ const Replace = ({
|
|
|
203
215
|
testId: replaceAll,
|
|
204
216
|
id: "replaceAll-button",
|
|
205
217
|
onClick: handleReplaceAllClick,
|
|
206
|
-
isDisabled: !canReplace
|
|
218
|
+
isDisabled: fg('platform_editor_find_and_replace_1') ? count.totalReplaceable === 0 : !canReplace
|
|
207
219
|
}, replaceAll)), /*#__PURE__*/React.createElement(Button, {
|
|
208
220
|
appearance: "subtle",
|
|
209
221
|
testId: closeFindReplaceDialog,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { FindReplaceActionTypes } from './actions';
|
|
4
5
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
5
6
|
import { createDecoration, findDecorationFromMatch, findMatches, findSearchIndex, getSelectedText, getSelectionForMatch, nextIndex, prevIndex, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
@@ -146,6 +147,9 @@ export var replace = function replace(replaceText) {
|
|
|
146
147
|
index = _getPluginState6.index,
|
|
147
148
|
findText = _getPluginState6.findText;
|
|
148
149
|
if (matches[index]) {
|
|
150
|
+
if (!matches[index].canReplace && fg('platform_editor_find_and_replace_1')) {
|
|
151
|
+
return tr;
|
|
152
|
+
}
|
|
149
153
|
var _matches$index = matches[index],
|
|
150
154
|
start = _matches$index.start,
|
|
151
155
|
end = _matches$index.end;
|
|
@@ -165,6 +169,9 @@ export var replaceAll = function replaceAll(replaceText) {
|
|
|
165
169
|
}, function (tr, state) {
|
|
166
170
|
var pluginState = getPluginState(state);
|
|
167
171
|
pluginState.matches.forEach(function (match) {
|
|
172
|
+
if (!match.canReplace && fg('platform_editor_find_and_replace_1')) {
|
|
173
|
+
return tr;
|
|
174
|
+
}
|
|
168
175
|
tr.insertText(replaceText, tr.mapping.map(match.start), tr.mapping.map(match.end));
|
|
169
176
|
});
|
|
170
177
|
tr.setMeta('scrollIntoView', false);
|
|
@@ -105,6 +105,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
105
105
|
var _this$props = this.props,
|
|
106
106
|
findText = _this$props.findText,
|
|
107
107
|
count = _this$props.count,
|
|
108
|
+
isReplaceable = _this$props.isReplaceable,
|
|
108
109
|
shouldFocus = _this$props.shouldFocus,
|
|
109
110
|
onFind = _this$props.onFind,
|
|
110
111
|
onFindBlur = _this$props.onFindBlur,
|
|
@@ -145,7 +146,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
145
146
|
css: ruleStyles,
|
|
146
147
|
id: "replace-hr-element"
|
|
147
148
|
}), fg('editor_a11y_refactor_find_replace_style') ? jsx(ReplaceNext, {
|
|
148
|
-
canReplace: count.total > 0,
|
|
149
|
+
canReplace: fg('platform_editor_find_and_replace_1') ? !!isReplaceable : count.total > 0,
|
|
149
150
|
replaceText: replaceText,
|
|
150
151
|
onReplace: onReplace,
|
|
151
152
|
onReplaceAll: onReplaceAll,
|
|
@@ -160,7 +161,7 @@ var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
160
161
|
setFindTyped: this.setFindTyped,
|
|
161
162
|
focusToolbarButton: focusToolbarButton
|
|
162
163
|
}) : jsx(Replace, {
|
|
163
|
-
canReplace: count.total > 0,
|
|
164
|
+
canReplace: fg('platform_editor_find_and_replace_1') ? !!isReplaceable : count.total > 0,
|
|
164
165
|
replaceText: replaceText,
|
|
165
166
|
onReplace: onReplace,
|
|
166
167
|
onReplaceAll: onReplaceAll,
|
|
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import React, { useLayoutEffect, useState } from 'react';
|
|
3
3
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
import { blur, toggleMatchCase } from '../pm-plugins/commands';
|
|
6
7
|
import { activateWithAnalytics, cancelSearchWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, findWithAnalytics, replaceAllWithAnalytics, replaceWithAnalytics } from '../pm-plugins/commands-with-analytics';
|
|
7
8
|
import FindReplaceDropdown from './FindReplaceDropdown';
|
|
@@ -64,7 +65,7 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
64
65
|
};
|
|
65
66
|
});
|
|
66
67
|
var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithState(_ref2) {
|
|
67
|
-
var _api$analytics;
|
|
68
|
+
var _api$analytics, _matches$index;
|
|
68
69
|
var popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
69
70
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
70
71
|
popupsScrollableElement = _ref2.popupsScrollableElement,
|
|
@@ -177,6 +178,10 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
|
|
|
177
178
|
findText: findText,
|
|
178
179
|
index: index,
|
|
179
180
|
numMatches: matches.length,
|
|
181
|
+
isReplaceable: fg('platform_editor_find_and_replace_1') ? (_matches$index = matches[index]) === null || _matches$index === void 0 ? void 0 : _matches$index.canReplace : undefined,
|
|
182
|
+
numReplaceable: fg('platform_editor_find_and_replace_1') ? matches.filter(function (match) {
|
|
183
|
+
return match.canReplace === true;
|
|
184
|
+
}).length : undefined,
|
|
180
185
|
replaceText: replaceText,
|
|
181
186
|
shouldFocus: shouldFocus,
|
|
182
187
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
@@ -20,6 +20,7 @@ var FindReplaceDropdown = function FindReplaceDropdown(props) {
|
|
|
20
20
|
index = props.index,
|
|
21
21
|
numMatches = props.numMatches,
|
|
22
22
|
popupsMountPoint = props.popupsMountPoint,
|
|
23
|
+
numReplaceable = props.numReplaceable,
|
|
23
24
|
onCancel = props.onCancel;
|
|
24
25
|
if (!popupsMountPoint) {
|
|
25
26
|
return null;
|
|
@@ -52,7 +53,8 @@ var FindReplaceDropdown = function FindReplaceDropdown(props) {
|
|
|
52
53
|
replaceText: replaceText,
|
|
53
54
|
count: {
|
|
54
55
|
index: index,
|
|
55
|
-
total: numMatches
|
|
56
|
+
total: numMatches,
|
|
57
|
+
totalReplaceable: numReplaceable
|
|
56
58
|
}
|
|
57
59
|
// Ignored via go/ees005
|
|
58
60
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -101,6 +101,7 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
101
101
|
isActive = _this$props.isActive,
|
|
102
102
|
index = _this$props.index,
|
|
103
103
|
numMatches = _this$props.numMatches,
|
|
104
|
+
numReplaceable = _this$props.numReplaceable,
|
|
104
105
|
formatMessage = _this$props.intl.formatMessage,
|
|
105
106
|
takeFullWidth = _this$props.takeFullWidth,
|
|
106
107
|
_this$props$isButtonH = _this$props.isButtonHidden,
|
|
@@ -182,7 +183,8 @@ var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
182
183
|
replaceText: replaceText,
|
|
183
184
|
count: {
|
|
184
185
|
index: index,
|
|
185
|
-
total: numMatches
|
|
186
|
+
total: numMatches,
|
|
187
|
+
totalReplaceable: numReplaceable
|
|
186
188
|
},
|
|
187
189
|
focusToolbarButton: this.focusToolbarButton
|
|
188
190
|
// Ignored via go/ees005
|
package/dist/esm/ui/Replace.js
CHANGED
|
@@ -20,8 +20,9 @@ import Button from '@atlaskit/button/new';
|
|
|
20
20
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
21
21
|
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
22
22
|
import { Label, ValidMessage } from '@atlaskit/form';
|
|
23
|
-
import ChevronDownIcon from '@atlaskit/icon/
|
|
24
|
-
import ChevronUpIcon from '@atlaskit/icon/
|
|
23
|
+
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down--hipchat-chevron-down';
|
|
24
|
+
import ChevronUpIcon from '@atlaskit/icon/core/migration/chevron-up--hipchat-chevron-up';
|
|
25
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
25
26
|
import { Inline, xcss } from '@atlaskit/primitives';
|
|
26
27
|
import Textfield from '@atlaskit/textfield';
|
|
27
28
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
@@ -96,10 +97,17 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
96
97
|
_this.setState({
|
|
97
98
|
isHelperMessageVisible: true
|
|
98
99
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
if (_this.props.count.totalReplaceable && fg('platform_editor_find_and_replace_1')) {
|
|
101
|
+
_this.triggerSuccessReplacementMessageUpdate(_this.props.count.totalReplaceable);
|
|
102
|
+
_this.setState({
|
|
103
|
+
replaceCount: _this.props.count.totalReplaceable
|
|
104
|
+
});
|
|
105
|
+
} else {
|
|
106
|
+
_this.triggerSuccessReplacementMessageUpdate(_this.props.count.total);
|
|
107
|
+
_this.setState({
|
|
108
|
+
replaceCount: _this.props.count.total
|
|
109
|
+
});
|
|
110
|
+
}
|
|
103
111
|
_this.props.setFindTyped(false);
|
|
104
112
|
});
|
|
105
113
|
});
|
|
@@ -245,7 +253,12 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
245
253
|
css: nextPreviousItemStyles
|
|
246
254
|
}, jsx(FindReplaceTooltipButton, {
|
|
247
255
|
title: this.findNext,
|
|
248
|
-
icon:
|
|
256
|
+
icon: function icon(iconProps) {
|
|
257
|
+
return jsx(ChevronDownIcon, {
|
|
258
|
+
label: iconProps.label,
|
|
259
|
+
size: "small"
|
|
260
|
+
});
|
|
261
|
+
},
|
|
249
262
|
iconLabel: this.findNext,
|
|
250
263
|
keymapDescription: 'Enter',
|
|
251
264
|
onClick: this.handleFindNextClick,
|
|
@@ -254,7 +267,12 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
254
267
|
css: nextPreviousItemStyles
|
|
255
268
|
}, jsx(FindReplaceTooltipButton, {
|
|
256
269
|
title: this.findPrevious,
|
|
257
|
-
icon:
|
|
270
|
+
icon: function icon(iconProps) {
|
|
271
|
+
return jsx(ChevronUpIcon, {
|
|
272
|
+
label: iconProps.label,
|
|
273
|
+
size: "small"
|
|
274
|
+
});
|
|
275
|
+
},
|
|
258
276
|
iconLabel: this.findPrevious,
|
|
259
277
|
keymapDescription: 'Shift Enter',
|
|
260
278
|
onClick: this.handleFindPrevClick,
|
|
@@ -279,7 +297,7 @@ var Replace = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
279
297
|
testId: this.replaceAll,
|
|
280
298
|
id: "replaceAll-button",
|
|
281
299
|
onClick: this.handleReplaceAllClick,
|
|
282
|
-
isDisabled: !canReplace
|
|
300
|
+
isDisabled: fg('platform_editor_find_and_replace_1') ? count.totalReplaceable === 0 : !canReplace
|
|
283
301
|
}, this.replaceAll))), jsx("div", {
|
|
284
302
|
css: orderZeroStyles
|
|
285
303
|
}, jsx(Button, {
|
|
@@ -5,8 +5,9 @@ import Button from '@atlaskit/button/new';
|
|
|
5
5
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
7
|
import { ValidMessage } from '@atlaskit/form';
|
|
8
|
-
import ChevronDownIcon from '@atlaskit/icon/
|
|
9
|
-
import ChevronUpIcon from '@atlaskit/icon/
|
|
8
|
+
import ChevronDownIcon from '@atlaskit/icon/core/migration/chevron-down--hipchat-chevron-down';
|
|
9
|
+
import ChevronUpIcon from '@atlaskit/icon/core/migration/chevron-up--hipchat-chevron-up';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { Box, Inline, Text, xcss } from '@atlaskit/primitives';
|
|
11
12
|
import Textfield from '@atlaskit/textfield';
|
|
12
13
|
import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
|
|
@@ -134,8 +135,13 @@ var Replace = function Replace(_ref) {
|
|
|
134
135
|
replaceText: replaceText
|
|
135
136
|
});
|
|
136
137
|
setIsHelperMessageVisible(true);
|
|
137
|
-
|
|
138
|
-
|
|
138
|
+
if (count.totalReplaceable && fg('platform_editor_find_and_replace_1')) {
|
|
139
|
+
triggerSuccessReplacementMessageUpdate(count.totalReplaceable);
|
|
140
|
+
setReplaceCount(count.totalReplaceable);
|
|
141
|
+
} else {
|
|
142
|
+
triggerSuccessReplacementMessageUpdate(count.total);
|
|
143
|
+
setReplaceCount(count.total);
|
|
144
|
+
}
|
|
139
145
|
setFindTyped(false);
|
|
140
146
|
});
|
|
141
147
|
};
|
|
@@ -202,14 +208,24 @@ var Replace = function Replace(_ref) {
|
|
|
202
208
|
xcss: actionButtonInlineStyles
|
|
203
209
|
}, /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
|
|
204
210
|
title: formatMessage(messages.findNext),
|
|
205
|
-
icon:
|
|
211
|
+
icon: function icon(iconProps) {
|
|
212
|
+
return /*#__PURE__*/React.createElement(ChevronDownIcon, {
|
|
213
|
+
label: iconProps.label,
|
|
214
|
+
size: "small"
|
|
215
|
+
});
|
|
216
|
+
},
|
|
206
217
|
iconLabel: formatMessage(messages.findNext),
|
|
207
218
|
keymapDescription: 'Enter',
|
|
208
219
|
onClick: handleFindNextClick,
|
|
209
220
|
disabled: count.total <= 1
|
|
210
221
|
}), /*#__PURE__*/React.createElement(FindReplaceTooltipButton, {
|
|
211
222
|
title: findPrevious,
|
|
212
|
-
icon:
|
|
223
|
+
icon: function icon(iconProps) {
|
|
224
|
+
return /*#__PURE__*/React.createElement(ChevronUpIcon, {
|
|
225
|
+
label: iconProps.label,
|
|
226
|
+
size: "small"
|
|
227
|
+
});
|
|
228
|
+
},
|
|
213
229
|
iconLabel: findPrevious,
|
|
214
230
|
keymapDescription: 'Shift Enter',
|
|
215
231
|
onClick: handleFindPrevClick,
|
|
@@ -224,7 +240,7 @@ var Replace = function Replace(_ref) {
|
|
|
224
240
|
testId: replaceAll,
|
|
225
241
|
id: "replaceAll-button",
|
|
226
242
|
onClick: handleReplaceAllClick,
|
|
227
|
-
isDisabled: !canReplace
|
|
243
|
+
isDisabled: fg('platform_editor_find_and_replace_1') ? count.totalReplaceable === 0 : !canReplace
|
|
228
244
|
}, replaceAll)), /*#__PURE__*/React.createElement(Button, {
|
|
229
245
|
appearance: "subtle",
|
|
230
246
|
testId: closeFindReplaceDialog,
|
|
@@ -6,6 +6,8 @@ export interface FindReplaceDropdownProps extends Omit<FindReplaceProps, 'count'
|
|
|
6
6
|
index: number;
|
|
7
7
|
numMatches: number;
|
|
8
8
|
isActive: boolean;
|
|
9
|
+
isReplaceable?: boolean;
|
|
10
|
+
numReplaceable?: number;
|
|
9
11
|
popupsMountPoint?: HTMLElement;
|
|
10
12
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
11
13
|
}
|
|
@@ -10,6 +10,7 @@ export interface FindReplaceToolbarButtonProps extends Omit<FindReplaceProps, 'c
|
|
|
10
10
|
index: number;
|
|
11
11
|
numMatches: number;
|
|
12
12
|
isActive: boolean;
|
|
13
|
+
numReplaceable?: number;
|
|
13
14
|
onActivate: () => void;
|
|
14
15
|
isReducedSpacing?: boolean;
|
|
15
16
|
popupsMountPoint?: HTMLElement;
|
|
@@ -6,6 +6,8 @@ export interface FindReplaceDropdownProps extends Omit<FindReplaceProps, 'count'
|
|
|
6
6
|
index: number;
|
|
7
7
|
numMatches: number;
|
|
8
8
|
isActive: boolean;
|
|
9
|
+
isReplaceable?: boolean;
|
|
10
|
+
numReplaceable?: number;
|
|
9
11
|
popupsMountPoint?: HTMLElement;
|
|
10
12
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
11
13
|
}
|
|
@@ -10,6 +10,7 @@ export interface FindReplaceToolbarButtonProps extends Omit<FindReplaceProps, 'c
|
|
|
10
10
|
index: number;
|
|
11
11
|
numMatches: number;
|
|
12
12
|
isActive: boolean;
|
|
13
|
+
numReplaceable?: number;
|
|
13
14
|
onActivate: () => void;
|
|
14
15
|
isReducedSpacing?: boolean;
|
|
15
16
|
popupsMountPoint?: HTMLElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-find-replace",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.1",
|
|
4
4
|
"description": "find replace plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/button": "^23.2.0",
|
|
36
|
-
"@atlaskit/editor-common": "^106.
|
|
36
|
+
"@atlaskit/editor-common": "^106.6.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/primitives": "^14.8.0",
|
|
45
45
|
"@atlaskit/textfield": "^8.0.0",
|
|
46
46
|
"@atlaskit/theme": "^18.0.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^7.0.0",
|
|
48
48
|
"@atlaskit/tokens": "^5.1.0",
|
|
49
49
|
"@atlaskit/tooltip": "^20.3.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|