@atlaskit/editor-plugin-find-replace 2.2.6 → 2.2.8
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 +15 -0
- package/dist/cjs/pm-plugins/commands.js +2 -2
- package/dist/cjs/pm-plugins/plugin-factory.js +2 -1
- package/dist/cjs/pm-plugins/utils/batch-decorations.js +2 -2
- package/dist/cjs/pm-plugins/utils/index.js +3 -1
- package/dist/cjs/ui/FindReplaceDropDownOrToolbarButtonWithState.js +1 -2
- package/dist/cjs/ui/Replace.js +1 -2
- package/dist/cjs/ui/ReplaceNext.js +4 -5
- package/dist/es2019/pm-plugins/plugin-factory.js +2 -1
- package/dist/es2019/pm-plugins/utils/index.js +3 -1
- package/dist/esm/pm-plugins/commands.js +2 -2
- package/dist/esm/pm-plugins/plugin-factory.js +2 -1
- package/dist/esm/pm-plugins/utils/batch-decorations.js +2 -2
- package/dist/esm/pm-plugins/utils/index.js +3 -1
- package/dist/esm/ui/ReplaceNext.js +3 -3
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-find-replace
|
|
2
2
|
|
|
3
|
+
## 2.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#165597](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165597)
|
|
8
|
+
[`7091d26926b74`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7091d26926b74) -
|
|
9
|
+
[ED-28128] this change is adding an optional field to the Match type in the FindReplace plugin
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.2.7
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.2.6
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -220,8 +220,8 @@ var updateSelectedHighlight = function updateSelectedHighlight(state, nextSelect
|
|
|
220
220
|
var _getPluginState9 = (0, _pluginFactory.getPluginState)(state),
|
|
221
221
|
index = _getPluginState9.index,
|
|
222
222
|
matches = _getPluginState9.matches;
|
|
223
|
-
var
|
|
224
|
-
decorationSet =
|
|
223
|
+
var _getPluginState0 = (0, _pluginFactory.getPluginState)(state),
|
|
224
|
+
decorationSet = _getPluginState0.decorationSet;
|
|
225
225
|
var currentSelectedMatch = matches[index];
|
|
226
226
|
var nextSelectedMatch = matches[nextSelectedIndex];
|
|
227
227
|
if (index === nextSelectedIndex) {
|
|
@@ -40,7 +40,8 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
|
40
40
|
var mappedMatches = matches.map(function (match) {
|
|
41
41
|
return {
|
|
42
42
|
start: tr.mapping.map(match.start),
|
|
43
|
-
end: tr.mapping.map(match.end)
|
|
43
|
+
end: tr.mapping.map(match.end),
|
|
44
|
+
canReplace: match.canReplace
|
|
44
45
|
};
|
|
45
46
|
});
|
|
46
47
|
var matchesToAdd = [];
|
|
@@ -177,7 +177,7 @@ var BatchDecorations = /*#__PURE__*/function () {
|
|
|
177
177
|
}
|
|
178
178
|
}, _callee3, this);
|
|
179
179
|
}));
|
|
180
|
-
function addDecorationsBetween(_x8, _x9,
|
|
180
|
+
function addDecorationsBetween(_x8, _x9, _x0) {
|
|
181
181
|
return _addDecorationsBetween.apply(this, arguments);
|
|
182
182
|
}
|
|
183
183
|
return addDecorationsBetween;
|
|
@@ -227,7 +227,7 @@ var BatchDecorations = /*#__PURE__*/function () {
|
|
|
227
227
|
}
|
|
228
228
|
}, _callee4, this);
|
|
229
229
|
}));
|
|
230
|
-
function removeDecorationsBetween(
|
|
230
|
+
function removeDecorationsBetween(_x1, _x10, _x11) {
|
|
231
231
|
return _removeDecorationsBetween.apply(this, arguments);
|
|
232
232
|
}
|
|
233
233
|
return removeDecorationsBetween;
|
|
@@ -10,6 +10,7 @@ exports.getSelectedText = getSelectedText;
|
|
|
10
10
|
exports.removeMatchesFromSet = exports.removeDecorationsFromSet = exports.prevIndex = exports.nextIndex = exports.isMatchAffectedByStep = exports.getSelectionForMatch = void 0;
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
12
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _styles = require("../../ui/styles");
|
|
14
15
|
function getSelectedText(selection) {
|
|
15
16
|
var text = '';
|
|
@@ -60,7 +61,8 @@ function findMatches(content, searchText, shouldMatchCase) {
|
|
|
60
61
|
// Add the substring index to the position of the node
|
|
61
62
|
matches.push({
|
|
62
63
|
start: pos + index,
|
|
63
|
-
end: pos + end
|
|
64
|
+
end: pos + end,
|
|
65
|
+
canReplace: (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_1') ? true : undefined
|
|
64
66
|
});
|
|
65
67
|
index = text.indexOf(searchText, end);
|
|
66
68
|
}
|
|
@@ -15,8 +15,7 @@ var _commandsWithAnalytics = require("../pm-plugins/commands-with-analytics");
|
|
|
15
15
|
var _FindReplaceDropdown = _interopRequireDefault(require("./FindReplaceDropdown"));
|
|
16
16
|
var _FindReplaceToolbarButton = _interopRequireDefault(require("./FindReplaceToolbarButton"));
|
|
17
17
|
var _useFindReplacePluginStateSelector = require("./hooks/useFindReplacePluginStateSelector");
|
|
18
|
-
function
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
19
|
// light implementation of useSharedPluginState(). This is due to findreplace
|
|
21
20
|
// being the only plugin that previously used WithPluginState with
|
|
22
21
|
// debounce=false. That was implemented because of text sync issues
|
package/dist/cjs/ui/Replace.js
CHANGED
|
@@ -25,8 +25,7 @@ var _primitives = require("@atlaskit/primitives");
|
|
|
25
25
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
26
26
|
var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
|
|
27
27
|
var _uiStyles = require("./ui-styles");
|
|
28
|
-
function
|
|
29
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
30
29
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
31
30
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @atlaskit/design-system/consistent-css-prop-usage */ /**
|
|
32
31
|
* @jsxRuntime classic
|
|
@@ -18,8 +18,7 @@ var _chevronUpHipchatChevronUp = _interopRequireDefault(require("@atlaskit/icon/
|
|
|
18
18
|
var _primitives = require("@atlaskit/primitives");
|
|
19
19
|
var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
|
|
20
20
|
var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
|
|
21
|
-
function
|
|
22
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
23
22
|
var replaceContainerStyles = (0, _primitives.xcss)({
|
|
24
23
|
padding: 'space.100'
|
|
25
24
|
});
|
|
@@ -69,9 +68,9 @@ var Replace = function Replace(_ref) {
|
|
|
69
68
|
fakeSuccessReplacementMessageUpdate = _useState8[0],
|
|
70
69
|
setFakeSuccessReplacementMessageUpdate = _useState8[1];
|
|
71
70
|
var _useState9 = (0, _react.useState)(0),
|
|
72
|
-
|
|
73
|
-
replaceCount =
|
|
74
|
-
setReplaceCount =
|
|
71
|
+
_useState0 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
72
|
+
replaceCount = _useState0[0],
|
|
73
|
+
setReplaceCount = _useState0[1];
|
|
75
74
|
var replaceTextfieldRef = (0, _react.useRef)(null);
|
|
76
75
|
var successReplacementMessageRef = (0, _react.useRef)(null);
|
|
77
76
|
var replaceWith = formatMessage(_messages.findReplaceMessages.replaceWith);
|
|
@@ -31,7 +31,8 @@ const handleDocChanged = (tr, pluginState) => {
|
|
|
31
31
|
const numDecorations = decorationSet.find().length;
|
|
32
32
|
const mappedMatches = matches.map(match => ({
|
|
33
33
|
start: tr.mapping.map(match.start),
|
|
34
|
-
end: tr.mapping.map(match.end)
|
|
34
|
+
end: tr.mapping.map(match.end),
|
|
35
|
+
canReplace: match.canReplace
|
|
35
36
|
}));
|
|
36
37
|
let matchesToAdd = [];
|
|
37
38
|
let matchesToDelete = [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { searchMatchClass, selectedSearchMatchClass } from '../../ui/styles';
|
|
4
5
|
export function getSelectedText(selection) {
|
|
5
6
|
let text = '';
|
|
@@ -48,7 +49,8 @@ export function findMatches(content, searchText, shouldMatchCase, contentIndex =
|
|
|
48
49
|
// Add the substring index to the position of the node
|
|
49
50
|
matches.push({
|
|
50
51
|
start: pos + index,
|
|
51
|
-
end: pos + end
|
|
52
|
+
end: pos + end,
|
|
53
|
+
canReplace: fg('platform_editor_find_and_replace_1') ? true : undefined
|
|
52
54
|
});
|
|
53
55
|
index = text.indexOf(searchText, end);
|
|
54
56
|
}
|
|
@@ -213,8 +213,8 @@ var updateSelectedHighlight = function updateSelectedHighlight(state, nextSelect
|
|
|
213
213
|
var _getPluginState9 = getPluginState(state),
|
|
214
214
|
index = _getPluginState9.index,
|
|
215
215
|
matches = _getPluginState9.matches;
|
|
216
|
-
var
|
|
217
|
-
decorationSet =
|
|
216
|
+
var _getPluginState0 = getPluginState(state),
|
|
217
|
+
decorationSet = _getPluginState0.decorationSet;
|
|
218
218
|
var currentSelectedMatch = matches[index];
|
|
219
219
|
var nextSelectedMatch = matches[nextSelectedIndex];
|
|
220
220
|
if (index === nextSelectedIndex) {
|
|
@@ -32,7 +32,8 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
|
32
32
|
var mappedMatches = matches.map(function (match) {
|
|
33
33
|
return {
|
|
34
34
|
start: tr.mapping.map(match.start),
|
|
35
|
-
end: tr.mapping.map(match.end)
|
|
35
|
+
end: tr.mapping.map(match.end),
|
|
36
|
+
canReplace: match.canReplace
|
|
36
37
|
};
|
|
37
38
|
});
|
|
38
39
|
var matchesToAdd = [];
|
|
@@ -171,7 +171,7 @@ var BatchDecorations = /*#__PURE__*/function () {
|
|
|
171
171
|
}
|
|
172
172
|
}, _callee3, this);
|
|
173
173
|
}));
|
|
174
|
-
function addDecorationsBetween(_x8, _x9,
|
|
174
|
+
function addDecorationsBetween(_x8, _x9, _x0) {
|
|
175
175
|
return _addDecorationsBetween.apply(this, arguments);
|
|
176
176
|
}
|
|
177
177
|
return addDecorationsBetween;
|
|
@@ -221,7 +221,7 @@ var BatchDecorations = /*#__PURE__*/function () {
|
|
|
221
221
|
}
|
|
222
222
|
}, _callee4, this);
|
|
223
223
|
}));
|
|
224
|
-
function removeDecorationsBetween(
|
|
224
|
+
function removeDecorationsBetween(_x1, _x10, _x11) {
|
|
225
225
|
return _removeDecorationsBetween.apply(this, arguments);
|
|
226
226
|
}
|
|
227
227
|
return removeDecorationsBetween;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { searchMatchClass, selectedSearchMatchClass } from '../../ui/styles';
|
|
4
5
|
export function getSelectedText(selection) {
|
|
5
6
|
var text = '';
|
|
@@ -50,7 +51,8 @@ export function findMatches(content, searchText, shouldMatchCase) {
|
|
|
50
51
|
// Add the substring index to the position of the node
|
|
51
52
|
matches.push({
|
|
52
53
|
start: pos + index,
|
|
53
|
-
end: pos + end
|
|
54
|
+
end: pos + end,
|
|
55
|
+
canReplace: fg('platform_editor_find_and_replace_1') ? true : undefined
|
|
54
56
|
});
|
|
55
57
|
index = text.indexOf(searchText, end);
|
|
56
58
|
}
|
|
@@ -59,9 +59,9 @@ var Replace = function Replace(_ref) {
|
|
|
59
59
|
fakeSuccessReplacementMessageUpdate = _useState8[0],
|
|
60
60
|
setFakeSuccessReplacementMessageUpdate = _useState8[1];
|
|
61
61
|
var _useState9 = useState(0),
|
|
62
|
-
|
|
63
|
-
replaceCount =
|
|
64
|
-
setReplaceCount =
|
|
62
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
63
|
+
replaceCount = _useState0[0],
|
|
64
|
+
setReplaceCount = _useState0[1];
|
|
65
65
|
var replaceTextfieldRef = useRef(null);
|
|
66
66
|
var successReplacementMessageRef = useRef(null);
|
|
67
67
|
var replaceWith = formatMessage(messages.replaceWith);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-find-replace",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
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.2.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,9 +44,9 @@
|
|
|
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": "^5.
|
|
48
|
-
"@atlaskit/tokens": "^
|
|
49
|
-
"@atlaskit/tooltip": "^20.
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^5.12.0",
|
|
48
|
+
"@atlaskit/tokens": "^5.0.0",
|
|
49
|
+
"@atlaskit/tooltip": "^20.3.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
51
51
|
"@emotion/react": "^11.7.1",
|
|
52
52
|
"lodash": "^4.17.21",
|
|
@@ -118,6 +118,9 @@
|
|
|
118
118
|
},
|
|
119
119
|
"editor_a11y_refactor_find_replace_style": {
|
|
120
120
|
"type": "boolean"
|
|
121
|
+
},
|
|
122
|
+
"platform_editor_find_and_replace_1": {
|
|
123
|
+
"type": "boolean"
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
}
|