@atlaskit/editor-plugin-find-replace 8.0.3 → 8.1.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 +17 -0
- package/dist/cjs/pm-plugins/commands.js +12 -22
- package/dist/cjs/pm-plugins/main.js +2 -3
- package/dist/cjs/pm-plugins/plugin-factory.js +5 -9
- package/dist/es2019/pm-plugins/commands.js +12 -22
- package/dist/es2019/pm-plugins/main.js +2 -5
- package/dist/es2019/pm-plugins/plugin-factory.js +5 -9
- package/dist/esm/pm-plugins/commands.js +12 -22
- package/dist/esm/pm-plugins/main.js +2 -3
- package/dist/esm/pm-plugins/plugin-factory.js +5 -9
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-find-replace
|
|
2
2
|
|
|
3
|
+
## 8.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 8.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`0efca55740b36`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0efca55740b36) -
|
|
14
|
+
[FFCLEANUP-71458] clean up experiment platform_editor_toggle_expand_on_match_found
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 8.0.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -8,7 +8,6 @@ exports.toggleMatchCase = exports.replaceAll = exports.replace = exports.removeD
|
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
10
10
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
12
11
|
var _actions = require("./actions");
|
|
13
12
|
var _pluginFactory = require("./plugin-factory");
|
|
14
13
|
var _utils = require("./utils");
|
|
@@ -88,15 +87,12 @@ var find = exports.find = function find(editorView, containerElement, keyword) {
|
|
|
88
87
|
api: api
|
|
89
88
|
}) : [];
|
|
90
89
|
if (matches.length > 0) {
|
|
90
|
+
var _api$expand;
|
|
91
91
|
var index = (0, _expValEquals.expValEquals)('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? (0, _utils.findClosestMatch)(selection.from, matches) : (0, _utils.findSearchIndex)(selection.from, matches);
|
|
92
92
|
var newSelection = (0, _utils.getSelectionForMatch)(tr.selection, tr.doc, index, matches);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
97
|
-
tr: tr
|
|
98
|
-
});
|
|
99
|
-
}
|
|
93
|
+
api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
94
|
+
tr: tr
|
|
95
|
+
});
|
|
100
96
|
return tr.setSelection(newSelection);
|
|
101
97
|
}
|
|
102
98
|
return tr;
|
|
@@ -106,6 +102,7 @@ var findNext = exports.findNext = function findNext(editorView) {
|
|
|
106
102
|
return (0, _commands.withScrollIntoView)((0, _pluginFactory.createCommand)(function (state) {
|
|
107
103
|
return findInDirection(state, 'next');
|
|
108
104
|
}, function (tr, state) {
|
|
105
|
+
var _api$expand2;
|
|
109
106
|
var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
|
|
110
107
|
matches = _getPluginState4.matches,
|
|
111
108
|
index = _getPluginState4.index,
|
|
@@ -119,13 +116,9 @@ var findNext = exports.findNext = function findNext(editorView) {
|
|
|
119
116
|
searchIndex = (0, _utils.nextIndex)(searchIndex, matches.length);
|
|
120
117
|
}
|
|
121
118
|
var newSelection = (0, _utils.getSelectionForMatch)(tr.selection, tr.doc, searchIndex, matches);
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
api === null || api === void 0 || (_api$expand2 = api.expand) === null || _api$expand2 === void 0 || _api$expand2.commands.toggleExpandWithMatch(newSelection)({
|
|
126
|
-
tr: tr
|
|
127
|
-
});
|
|
128
|
-
}
|
|
119
|
+
api === null || api === void 0 || (_api$expand2 = api.expand) === null || _api$expand2 === void 0 || _api$expand2.commands.toggleExpandWithMatch(newSelection)({
|
|
120
|
+
tr: tr
|
|
121
|
+
});
|
|
129
122
|
return tr.setSelection(newSelection);
|
|
130
123
|
}));
|
|
131
124
|
};
|
|
@@ -133,6 +126,7 @@ var findPrevious = exports.findPrevious = function findPrevious(editorView) {
|
|
|
133
126
|
return (0, _commands.withScrollIntoView)((0, _pluginFactory.createCommand)(function (state) {
|
|
134
127
|
return findInDirection(state, 'previous');
|
|
135
128
|
}, function (tr, state) {
|
|
129
|
+
var _api$expand3;
|
|
136
130
|
var _getPluginState5 = (0, _pluginFactory.getPluginState)(state),
|
|
137
131
|
matches = _getPluginState5.matches,
|
|
138
132
|
api = _getPluginState5.api;
|
|
@@ -141,13 +135,9 @@ var findPrevious = exports.findPrevious = function findPrevious(editorView) {
|
|
|
141
135
|
// from the current cursor position)
|
|
142
136
|
var searchIndex = (0, _utils.findSearchIndex)(state.selection.from, matches, true);
|
|
143
137
|
var newSelection = (0, _utils.getSelectionForMatch)(tr.selection, tr.doc, searchIndex, matches);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
api === null || api === void 0 || (_api$expand3 = api.expand) === null || _api$expand3 === void 0 || _api$expand3.commands.toggleExpandWithMatch(newSelection)({
|
|
148
|
-
tr: tr
|
|
149
|
-
});
|
|
150
|
-
}
|
|
138
|
+
api === null || api === void 0 || (_api$expand3 = api.expand) === null || _api$expand3 === void 0 || _api$expand3.commands.toggleExpandWithMatch(newSelection)({
|
|
139
|
+
tr: tr
|
|
140
|
+
});
|
|
151
141
|
return tr.setSelection(newSelection);
|
|
152
142
|
}));
|
|
153
143
|
};
|
|
@@ -8,7 +8,6 @@ exports.initialState = exports.createPlugin = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
11
|
var _pluginFactory = require("./plugin-factory");
|
|
13
12
|
var _pluginKey = require("./plugin-key");
|
|
14
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -27,10 +26,10 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, getInt
|
|
|
27
26
|
return new _safePlugin.SafePlugin({
|
|
28
27
|
key: _pluginKey.findReplacePluginKey,
|
|
29
28
|
state: (0, _pluginFactory.createPluginState)(dispatch, function () {
|
|
30
|
-
return
|
|
29
|
+
return _objectSpread(_objectSpread({}, initialState), {}, {
|
|
31
30
|
getIntl: getIntl,
|
|
32
31
|
api: api
|
|
33
|
-
})
|
|
32
|
+
});
|
|
34
33
|
}),
|
|
35
34
|
props: {
|
|
36
35
|
decorations: function decorations(state) {
|
|
@@ -10,7 +10,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
10
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
12
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
14
13
|
var _main = require("./main");
|
|
15
14
|
var _pluginKey = require("./plugin-key");
|
|
16
15
|
var _reducer = _interopRequireDefault(require("./reducer"));
|
|
@@ -18,6 +17,7 @@ var _utils2 = require("./utils");
|
|
|
18
17
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
19
|
var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
20
|
+
var _api$expand;
|
|
21
21
|
var isActive = pluginState.isActive,
|
|
22
22
|
findText = pluginState.findText;
|
|
23
23
|
if (!isActive || !findText) {
|
|
@@ -107,14 +107,10 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
|
107
107
|
if (newSelectedMatch) {
|
|
108
108
|
decorationSet = decorationSet.add(tr.doc, (0, _utils2.createDecorations)(0, [newSelectedMatch]));
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
115
|
-
tr: tr
|
|
116
|
-
});
|
|
117
|
-
}
|
|
110
|
+
var newSelection = (0, _utils2.getSelectionForMatch)(tr.selection, tr.doc, newIndex, newMatches);
|
|
111
|
+
api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
112
|
+
tr: tr
|
|
113
|
+
});
|
|
118
114
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
119
115
|
matches: newMatches,
|
|
120
116
|
index: newIndex,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
4
|
import { FindReplaceActionTypes } from './actions';
|
|
6
5
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
7
6
|
import { createDecoration, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, getSelectedText, getSelectionForMatch, nextIndex, prevIndex, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
@@ -83,20 +82,18 @@ export const find = (editorView, containerElement, keyword) => withScrollIntoVie
|
|
|
83
82
|
api
|
|
84
83
|
}) : [];
|
|
85
84
|
if (matches.length > 0) {
|
|
85
|
+
var _api$expand;
|
|
86
86
|
const index = expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? findClosestMatch(selection.from, matches) : findSearchIndex(selection.from, matches);
|
|
87
87
|
const newSelection = getSelectionForMatch(tr.selection, tr.doc, index, matches);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
api === null || api === void 0 ? void 0 : (_api$expand = api.expand) === null || _api$expand === void 0 ? void 0 : _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
92
|
-
tr
|
|
93
|
-
});
|
|
94
|
-
}
|
|
88
|
+
api === null || api === void 0 ? void 0 : (_api$expand = api.expand) === null || _api$expand === void 0 ? void 0 : _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
89
|
+
tr
|
|
90
|
+
});
|
|
95
91
|
return tr.setSelection(newSelection);
|
|
96
92
|
}
|
|
97
93
|
return tr;
|
|
98
94
|
}));
|
|
99
95
|
export const findNext = editorView => withScrollIntoView(createCommand(state => findInDirection(state, 'next'), (tr, state) => {
|
|
96
|
+
var _api$expand2;
|
|
100
97
|
const {
|
|
101
98
|
matches,
|
|
102
99
|
index,
|
|
@@ -111,16 +108,13 @@ export const findNext = editorView => withScrollIntoView(createCommand(state =>
|
|
|
111
108
|
searchIndex = nextIndex(searchIndex, matches.length);
|
|
112
109
|
}
|
|
113
110
|
const newSelection = getSelectionForMatch(tr.selection, tr.doc, searchIndex, matches);
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
api === null || api === void 0 ? void 0 : (_api$expand2 = api.expand) === null || _api$expand2 === void 0 ? void 0 : _api$expand2.commands.toggleExpandWithMatch(newSelection)({
|
|
118
|
-
tr
|
|
119
|
-
});
|
|
120
|
-
}
|
|
111
|
+
api === null || api === void 0 ? void 0 : (_api$expand2 = api.expand) === null || _api$expand2 === void 0 ? void 0 : _api$expand2.commands.toggleExpandWithMatch(newSelection)({
|
|
112
|
+
tr
|
|
113
|
+
});
|
|
121
114
|
return tr.setSelection(newSelection);
|
|
122
115
|
}));
|
|
123
116
|
export const findPrevious = editorView => withScrollIntoView(createCommand(state => findInDirection(state, 'previous'), (tr, state) => {
|
|
117
|
+
var _api$expand3;
|
|
124
118
|
const {
|
|
125
119
|
matches,
|
|
126
120
|
api
|
|
@@ -130,13 +124,9 @@ export const findPrevious = editorView => withScrollIntoView(createCommand(state
|
|
|
130
124
|
// from the current cursor position)
|
|
131
125
|
const searchIndex = findSearchIndex(state.selection.from, matches, true);
|
|
132
126
|
const newSelection = getSelectionForMatch(tr.selection, tr.doc, searchIndex, matches);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
api === null || api === void 0 ? void 0 : (_api$expand3 = api.expand) === null || _api$expand3 === void 0 ? void 0 : _api$expand3.commands.toggleExpandWithMatch(newSelection)({
|
|
137
|
-
tr
|
|
138
|
-
});
|
|
139
|
-
}
|
|
127
|
+
api === null || api === void 0 ? void 0 : (_api$expand3 = api.expand) === null || _api$expand3 === void 0 ? void 0 : _api$expand3.commands.toggleExpandWithMatch(newSelection)({
|
|
128
|
+
tr
|
|
129
|
+
});
|
|
140
130
|
return tr.setSelection(newSelection);
|
|
141
131
|
}));
|
|
142
132
|
const findInDirection = (state, dir) => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
3
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
5
4
|
import { findReplacePluginKey } from './plugin-key';
|
|
6
5
|
export const initialState = {
|
|
@@ -16,13 +15,11 @@ export const initialState = {
|
|
|
16
15
|
export const createPlugin = (dispatch, getIntl, api) => {
|
|
17
16
|
return new SafePlugin({
|
|
18
17
|
key: findReplacePluginKey,
|
|
19
|
-
state: createPluginState(dispatch, () =>
|
|
18
|
+
state: createPluginState(dispatch, () => ({
|
|
20
19
|
...initialState,
|
|
21
20
|
getIntl,
|
|
22
21
|
api
|
|
23
|
-
}
|
|
24
|
-
...initialState
|
|
25
|
-
}),
|
|
22
|
+
})),
|
|
26
23
|
props: {
|
|
27
24
|
decorations(state) {
|
|
28
25
|
const {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { pluginFactory, stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
4
|
import { initialState } from './main';
|
|
6
5
|
import { findReplacePluginKey } from './plugin-key';
|
|
7
6
|
import reducer from './reducer';
|
|
8
7
|
import { createDecorations, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, findUniqueItemsIn, getSelectionForMatch, isMatchAffectedByStep, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
9
8
|
const handleDocChanged = (tr, pluginState) => {
|
|
9
|
+
var _api$expand;
|
|
10
10
|
const {
|
|
11
11
|
isActive,
|
|
12
12
|
findText
|
|
@@ -88,14 +88,10 @@ const handleDocChanged = (tr, pluginState) => {
|
|
|
88
88
|
if (newSelectedMatch) {
|
|
89
89
|
decorationSet = decorationSet.add(tr.doc, createDecorations(0, [newSelectedMatch]));
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
api === null || api === void 0 ? void 0 : (_api$expand = api.expand) === null || _api$expand === void 0 ? void 0 : _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
96
|
-
tr: tr
|
|
97
|
-
});
|
|
98
|
-
}
|
|
91
|
+
const newSelection = getSelectionForMatch(tr.selection, tr.doc, newIndex, newMatches);
|
|
92
|
+
api === null || api === void 0 ? void 0 : (_api$expand = api.expand) === null || _api$expand === void 0 ? void 0 : _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
93
|
+
tr: tr
|
|
94
|
+
});
|
|
99
95
|
return {
|
|
100
96
|
...pluginState,
|
|
101
97
|
matches: newMatches,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
4
|
import { FindReplaceActionTypes } from './actions';
|
|
6
5
|
import { createCommand, getPluginState } from './plugin-factory';
|
|
7
6
|
import { createDecoration, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, getSelectedText, getSelectionForMatch, nextIndex, prevIndex, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
@@ -81,15 +80,12 @@ export var find = function find(editorView, containerElement, keyword) {
|
|
|
81
80
|
api: api
|
|
82
81
|
}) : [];
|
|
83
82
|
if (matches.length > 0) {
|
|
83
|
+
var _api$expand;
|
|
84
84
|
var index = expValEquals('platform_editor_find_and_replace_improvements', 'isEnabled', true) ? findClosestMatch(selection.from, matches) : findSearchIndex(selection.from, matches);
|
|
85
85
|
var newSelection = getSelectionForMatch(tr.selection, tr.doc, index, matches);
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
90
|
-
tr: tr
|
|
91
|
-
});
|
|
92
|
-
}
|
|
86
|
+
api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
87
|
+
tr: tr
|
|
88
|
+
});
|
|
93
89
|
return tr.setSelection(newSelection);
|
|
94
90
|
}
|
|
95
91
|
return tr;
|
|
@@ -99,6 +95,7 @@ export var findNext = function findNext(editorView) {
|
|
|
99
95
|
return withScrollIntoView(createCommand(function (state) {
|
|
100
96
|
return findInDirection(state, 'next');
|
|
101
97
|
}, function (tr, state) {
|
|
98
|
+
var _api$expand2;
|
|
102
99
|
var _getPluginState4 = getPluginState(state),
|
|
103
100
|
matches = _getPluginState4.matches,
|
|
104
101
|
index = _getPluginState4.index,
|
|
@@ -112,13 +109,9 @@ export var findNext = function findNext(editorView) {
|
|
|
112
109
|
searchIndex = nextIndex(searchIndex, matches.length);
|
|
113
110
|
}
|
|
114
111
|
var newSelection = getSelectionForMatch(tr.selection, tr.doc, searchIndex, matches);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
api === null || api === void 0 || (_api$expand2 = api.expand) === null || _api$expand2 === void 0 || _api$expand2.commands.toggleExpandWithMatch(newSelection)({
|
|
119
|
-
tr: tr
|
|
120
|
-
});
|
|
121
|
-
}
|
|
112
|
+
api === null || api === void 0 || (_api$expand2 = api.expand) === null || _api$expand2 === void 0 || _api$expand2.commands.toggleExpandWithMatch(newSelection)({
|
|
113
|
+
tr: tr
|
|
114
|
+
});
|
|
122
115
|
return tr.setSelection(newSelection);
|
|
123
116
|
}));
|
|
124
117
|
};
|
|
@@ -126,6 +119,7 @@ export var findPrevious = function findPrevious(editorView) {
|
|
|
126
119
|
return withScrollIntoView(createCommand(function (state) {
|
|
127
120
|
return findInDirection(state, 'previous');
|
|
128
121
|
}, function (tr, state) {
|
|
122
|
+
var _api$expand3;
|
|
129
123
|
var _getPluginState5 = getPluginState(state),
|
|
130
124
|
matches = _getPluginState5.matches,
|
|
131
125
|
api = _getPluginState5.api;
|
|
@@ -134,13 +128,9 @@ export var findPrevious = function findPrevious(editorView) {
|
|
|
134
128
|
// from the current cursor position)
|
|
135
129
|
var searchIndex = findSearchIndex(state.selection.from, matches, true);
|
|
136
130
|
var newSelection = getSelectionForMatch(tr.selection, tr.doc, searchIndex, matches);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
api === null || api === void 0 || (_api$expand3 = api.expand) === null || _api$expand3 === void 0 || _api$expand3.commands.toggleExpandWithMatch(newSelection)({
|
|
141
|
-
tr: tr
|
|
142
|
-
});
|
|
143
|
-
}
|
|
131
|
+
api === null || api === void 0 || (_api$expand3 = api.expand) === null || _api$expand3 === void 0 || _api$expand3.commands.toggleExpandWithMatch(newSelection)({
|
|
132
|
+
tr: tr
|
|
133
|
+
});
|
|
144
134
|
return tr.setSelection(newSelection);
|
|
145
135
|
}));
|
|
146
136
|
};
|
|
@@ -3,7 +3,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
6
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
8
7
|
import { findReplacePluginKey } from './plugin-key';
|
|
9
8
|
export var initialState = {
|
|
@@ -20,10 +19,10 @@ export var createPlugin = function createPlugin(dispatch, getIntl, api) {
|
|
|
20
19
|
return new SafePlugin({
|
|
21
20
|
key: findReplacePluginKey,
|
|
22
21
|
state: createPluginState(dispatch, function () {
|
|
23
|
-
return
|
|
22
|
+
return _objectSpread(_objectSpread({}, initialState), {}, {
|
|
24
23
|
getIntl: getIntl,
|
|
25
24
|
api: api
|
|
26
|
-
})
|
|
25
|
+
});
|
|
27
26
|
}),
|
|
28
27
|
props: {
|
|
29
28
|
decorations: function decorations(state) {
|
|
@@ -5,12 +5,12 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import { pluginFactory, stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
6
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
9
8
|
import { initialState } from './main';
|
|
10
9
|
import { findReplacePluginKey } from './plugin-key';
|
|
11
10
|
import reducer from './reducer';
|
|
12
11
|
import { createDecorations, findClosestMatch, findDecorationFromMatch, findMatches, findSearchIndex, findUniqueItemsIn, getSelectionForMatch, isMatchAffectedByStep, removeDecorationsFromSet, removeMatchesFromSet } from './utils';
|
|
13
12
|
var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
13
|
+
var _api$expand;
|
|
14
14
|
var isActive = pluginState.isActive,
|
|
15
15
|
findText = pluginState.findText;
|
|
16
16
|
if (!isActive || !findText) {
|
|
@@ -100,14 +100,10 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
|
100
100
|
if (newSelectedMatch) {
|
|
101
101
|
decorationSet = decorationSet.add(tr.doc, createDecorations(0, [newSelectedMatch]));
|
|
102
102
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
108
|
-
tr: tr
|
|
109
|
-
});
|
|
110
|
-
}
|
|
103
|
+
var newSelection = getSelectionForMatch(tr.selection, tr.doc, newIndex, newMatches);
|
|
104
|
+
api === null || api === void 0 || (_api$expand = api.expand) === null || _api$expand === void 0 || _api$expand.commands.toggleExpandWithMatch(newSelection)({
|
|
105
|
+
tr: tr
|
|
106
|
+
});
|
|
111
107
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
112
108
|
matches: newMatches,
|
|
113
109
|
index: newIndex,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-find-replace",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.1",
|
|
4
4
|
"description": "find replace plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"@atlaskit/button": "^23.10.0",
|
|
32
32
|
"@atlaskit/editor-plugin-analytics": "^8.0.0",
|
|
33
33
|
"@atlaskit/editor-plugin-card": "^13.0.0",
|
|
34
|
-
"@atlaskit/editor-plugin-expand": "^9.
|
|
34
|
+
"@atlaskit/editor-plugin-expand": "^9.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-mentions": "^10.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-primary-toolbar": "^9.0.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
39
39
|
"@atlaskit/form": "^15.4.0",
|
|
40
|
-
"@atlaskit/icon": "^32.
|
|
41
|
-
"@atlaskit/icon-lab": "^5.
|
|
40
|
+
"@atlaskit/icon": "^32.1.0",
|
|
41
|
+
"@atlaskit/icon-lab": "^5.18.0",
|
|
42
42
|
"@atlaskit/mention": "^24.5.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
44
|
"@atlaskit/primitives": "^18.0.0",
|
|
45
45
|
"@atlaskit/textfield": "^8.2.0",
|
|
46
46
|
"@atlaskit/theme": "^22.0.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^40.0.0",
|
|
48
48
|
"@atlaskit/tokens": "^11.1.0",
|
|
49
49
|
"@atlaskit/tooltip": "^20.14.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react-dom": "^18.2.0"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@atlaskit/editor-common": "^112.
|
|
64
|
+
"@atlaskit/editor-common": "^112.4.0",
|
|
65
65
|
"react": "^18.2.0",
|
|
66
66
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
67
67
|
},
|