@atlaskit/editor-plugin-find-replace 2.6.1 → 2.7.0
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 +9 -0
- package/dist/cjs/findReplacePlugin.js +1 -1
- package/dist/cjs/pm-plugins/commands.js +27 -6
- package/dist/cjs/pm-plugins/main.js +3 -2
- package/dist/cjs/pm-plugins/plugin-factory.js +9 -2
- package/dist/cjs/pm-plugins/reducer.js +7 -1
- package/dist/cjs/pm-plugins/utils/index.js +43 -5
- package/dist/es2019/findReplacePlugin.js +1 -1
- package/dist/es2019/pm-plugins/commands.js +27 -6
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/es2019/pm-plugins/plugin-factory.js +9 -2
- package/dist/es2019/pm-plugins/reducer.js +10 -1
- package/dist/es2019/pm-plugins/utils/index.js +43 -3
- package/dist/esm/findReplacePlugin.js +1 -1
- package/dist/esm/pm-plugins/commands.js +27 -6
- package/dist/esm/pm-plugins/main.js +3 -2
- package/dist/esm/pm-plugins/plugin-factory.js +9 -2
- package/dist/esm/pm-plugins/reducer.js +7 -1
- package/dist/esm/pm-plugins/utils/index.js +43 -5
- package/dist/types/findReplacePluginType.d.ts +3 -1
- package/dist/types/pm-plugins/main.d.ts +3 -2
- package/dist/types/pm-plugins/utils/index.d.ts +12 -1
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types-ts4.5/findReplacePluginType.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/utils/index.d.ts +12 -1
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/package.json +6 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-find-replace
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#173285](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/173285)
|
|
8
|
+
[`91430cbcf0026`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/91430cbcf0026) -
|
|
9
|
+
[ux] ED-27957 extend the find algorithm to search mention nodes behind
|
|
10
|
+
platform_editor_find_and_replace_part_2
|
|
11
|
+
|
|
3
12
|
## 2.6.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -68,7 +68,7 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
|
|
|
68
68
|
plugin: function plugin(_ref3) {
|
|
69
69
|
var dispatch = _ref3.dispatch,
|
|
70
70
|
getIntl = _ref3.getIntl;
|
|
71
|
-
return (0, _main.createPlugin)(dispatch, getIntl);
|
|
71
|
+
return (0, _main.createPlugin)(dispatch, getIntl, api);
|
|
72
72
|
}
|
|
73
73
|
}, {
|
|
74
74
|
name: 'findReplaceKeymap',
|
|
@@ -25,8 +25,15 @@ var activate = exports.activate = function activate() {
|
|
|
25
25
|
findText = (0, _utils.getSelectedText)(selection);
|
|
26
26
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
27
27
|
shouldMatchCase = _getPluginState.shouldMatchCase,
|
|
28
|
-
getIntl = _getPluginState.getIntl
|
|
29
|
-
|
|
28
|
+
getIntl = _getPluginState.getIntl,
|
|
29
|
+
api = _getPluginState.api;
|
|
30
|
+
matches = (0, _utils.findMatches)({
|
|
31
|
+
content: state.doc,
|
|
32
|
+
searchText: findText,
|
|
33
|
+
shouldMatchCase: shouldMatchCase,
|
|
34
|
+
getIntl: getIntl,
|
|
35
|
+
api: api
|
|
36
|
+
});
|
|
30
37
|
index = (0, _utils.findSearchIndex)(selection.from, matches);
|
|
31
38
|
}
|
|
32
39
|
return {
|
|
@@ -42,8 +49,15 @@ var find = exports.find = function find(editorView, containerElement, keyword) {
|
|
|
42
49
|
var selection = state.selection;
|
|
43
50
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
44
51
|
shouldMatchCase = _getPluginState2.shouldMatchCase,
|
|
45
|
-
getIntl = _getPluginState2.getIntl
|
|
46
|
-
|
|
52
|
+
getIntl = _getPluginState2.getIntl,
|
|
53
|
+
api = _getPluginState2.api;
|
|
54
|
+
var matches = keyword !== undefined ? (0, _utils.findMatches)({
|
|
55
|
+
content: state.doc,
|
|
56
|
+
searchText: keyword,
|
|
57
|
+
shouldMatchCase: shouldMatchCase,
|
|
58
|
+
getIntl: getIntl,
|
|
59
|
+
api: api
|
|
60
|
+
}) : [];
|
|
47
61
|
var index = (0, _utils.findSearchIndex)(selection.from, matches);
|
|
48
62
|
|
|
49
63
|
// we can't just apply all the decorations to highlight the search results at once
|
|
@@ -63,8 +77,15 @@ var find = exports.find = function find(editorView, containerElement, keyword) {
|
|
|
63
77
|
var selection = state.selection;
|
|
64
78
|
var _getPluginState3 = (0, _pluginFactory.getPluginState)(state),
|
|
65
79
|
shouldMatchCase = _getPluginState3.shouldMatchCase,
|
|
66
|
-
getIntl = _getPluginState3.getIntl
|
|
67
|
-
|
|
80
|
+
getIntl = _getPluginState3.getIntl,
|
|
81
|
+
api = _getPluginState3.api;
|
|
82
|
+
var matches = keyword !== undefined ? (0, _utils.findMatches)({
|
|
83
|
+
content: state.doc,
|
|
84
|
+
searchText: keyword,
|
|
85
|
+
shouldMatchCase: shouldMatchCase,
|
|
86
|
+
getIntl: getIntl,
|
|
87
|
+
api: api
|
|
88
|
+
}) : [];
|
|
68
89
|
if (matches.length > 0) {
|
|
69
90
|
var index = (0, _utils.findSearchIndex)(selection.from, matches);
|
|
70
91
|
return tr.setSelection((0, _utils.getSelectionForMatch)(tr.selection, tr.doc, index, matches));
|
|
@@ -23,12 +23,13 @@ var initialState = exports.initialState = {
|
|
|
23
23
|
decorationSet: _view.DecorationSet.empty,
|
|
24
24
|
shouldMatchCase: false
|
|
25
25
|
};
|
|
26
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatch, getIntl) {
|
|
26
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatch, getIntl, api) {
|
|
27
27
|
return new _safePlugin.SafePlugin({
|
|
28
28
|
key: _pluginKey.findReplacePluginKey,
|
|
29
29
|
state: (0, _pluginFactory.createPluginState)(dispatch, function () {
|
|
30
30
|
return (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_part_2') ? _objectSpread(_objectSpread({}, initialState), {}, {
|
|
31
|
-
getIntl: getIntl
|
|
31
|
+
getIntl: getIntl,
|
|
32
|
+
api: api
|
|
32
33
|
}) : _objectSpread({}, initialState);
|
|
33
34
|
}),
|
|
34
35
|
props: {
|
|
@@ -34,8 +34,15 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
|
34
34
|
decorationSet = pluginState.decorationSet,
|
|
35
35
|
matches = pluginState.matches,
|
|
36
36
|
shouldMatchCase = pluginState.shouldMatchCase,
|
|
37
|
-
getIntl = pluginState.getIntl
|
|
38
|
-
|
|
37
|
+
getIntl = pluginState.getIntl,
|
|
38
|
+
api = pluginState.api;
|
|
39
|
+
var newMatches = (0, _utils2.findMatches)({
|
|
40
|
+
content: tr.doc,
|
|
41
|
+
searchText: findText,
|
|
42
|
+
shouldMatchCase: shouldMatchCase,
|
|
43
|
+
getIntl: getIntl,
|
|
44
|
+
api: api
|
|
45
|
+
});
|
|
39
46
|
decorationSet = decorationSet.map(tr.mapping, tr.doc);
|
|
40
47
|
var numDecorations = decorationSet.find().length;
|
|
41
48
|
var mappedMatches = matches.map(function (match) {
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _actions = require("./actions");
|
|
10
11
|
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; }
|
|
11
12
|
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; }
|
|
@@ -44,7 +45,12 @@ var reducer = function reducer(getInitialState) {
|
|
|
44
45
|
index: action.index
|
|
45
46
|
});
|
|
46
47
|
case _actions.FindReplaceActionTypes.CANCEL:
|
|
47
|
-
|
|
48
|
+
var getIntl = state.getIntl,
|
|
49
|
+
api = state.api;
|
|
50
|
+
return (0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_part_2') ? _objectSpread(_objectSpread({}, getInitialState()), {}, {
|
|
51
|
+
getIntl: getIntl,
|
|
52
|
+
api: api
|
|
53
|
+
}) : getInitialState();
|
|
48
54
|
case _actions.FindReplaceActionTypes.BLUR:
|
|
49
55
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
50
56
|
shouldFocus: false
|
|
@@ -11,6 +11,8 @@ exports.removeMatchesFromSet = exports.removeDecorationsFromSet = exports.prevIn
|
|
|
11
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
12
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
13
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
14
|
+
var _resource = require("@atlaskit/mention/resource");
|
|
15
|
+
var _types = require("@atlaskit/mention/types");
|
|
14
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
17
|
var _styles = require("../../ui/styles");
|
|
16
18
|
function getSelectedText(selection) {
|
|
@@ -37,9 +39,14 @@ var createDecoration = exports.createDecoration = function createDecoration(star
|
|
|
37
39
|
class: className
|
|
38
40
|
});
|
|
39
41
|
};
|
|
40
|
-
function findMatches(
|
|
41
|
-
var
|
|
42
|
-
|
|
42
|
+
function findMatches(_ref2) {
|
|
43
|
+
var content = _ref2.content,
|
|
44
|
+
searchText = _ref2.searchText,
|
|
45
|
+
shouldMatchCase = _ref2.shouldMatchCase,
|
|
46
|
+
_ref2$contentIndex = _ref2.contentIndex,
|
|
47
|
+
contentIndex = _ref2$contentIndex === void 0 ? 0 : _ref2$contentIndex,
|
|
48
|
+
getIntl = _ref2.getIntl,
|
|
49
|
+
api = _ref2.api;
|
|
43
50
|
var matches = [];
|
|
44
51
|
var searchTextLength = searchText.length;
|
|
45
52
|
var textGrouping = null;
|
|
@@ -95,7 +102,7 @@ function findMatches(content, searchText, shouldMatchCase) {
|
|
|
95
102
|
});
|
|
96
103
|
}
|
|
97
104
|
};
|
|
98
|
-
var
|
|
105
|
+
var collectDateOrMentionMatch = function collectDateOrMentionMatch(textGrouping, nodeSize) {
|
|
99
106
|
if (!textGrouping) {
|
|
100
107
|
return;
|
|
101
108
|
}
|
|
@@ -139,12 +146,43 @@ function findMatches(content, searchText, shouldMatchCase) {
|
|
|
139
146
|
break;
|
|
140
147
|
case 'date':
|
|
141
148
|
if ((0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_part_2')) {
|
|
142
|
-
|
|
149
|
+
collectDateOrMentionMatch({
|
|
143
150
|
text: (0, _utils.timestampToString)(node.attrs.timestamp, getIntl ? getIntl() : null),
|
|
144
151
|
pos: pos
|
|
145
152
|
}, node.nodeSize);
|
|
146
153
|
}
|
|
147
154
|
break;
|
|
155
|
+
case 'mention':
|
|
156
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_find_and_replace_part_2')) {
|
|
157
|
+
var text;
|
|
158
|
+
if (node.attrs.text) {
|
|
159
|
+
text = node.attrs.text;
|
|
160
|
+
} else {
|
|
161
|
+
var _api$mention;
|
|
162
|
+
// the text may be sanitised from the node for privacy reasons
|
|
163
|
+
// so we need to use the mentionProvider to resolve it
|
|
164
|
+
var mentionProvider = api === null || api === void 0 || (_api$mention = api.mention) === null || _api$mention === void 0 || (_api$mention = _api$mention.sharedState.currentState()) === null || _api$mention === void 0 ? void 0 : _api$mention.mentionProvider;
|
|
165
|
+
if ((0, _resource.isResolvingMentionProvider)(mentionProvider)) {
|
|
166
|
+
var nameDetail = mentionProvider.resolveMentionName(node.attrs.id);
|
|
167
|
+
if ((0, _types.isPromise)(nameDetail)) {
|
|
168
|
+
text = '@...';
|
|
169
|
+
} else {
|
|
170
|
+
if (nameDetail.status === _types.MentionNameStatus.OK) {
|
|
171
|
+
text = "@".concat(nameDetail.name || '');
|
|
172
|
+
} else {
|
|
173
|
+
text = '@_|unknown|_';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (text) {
|
|
179
|
+
collectDateOrMentionMatch({
|
|
180
|
+
text: text,
|
|
181
|
+
pos: pos
|
|
182
|
+
}, node.nodeSize);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
148
186
|
default:
|
|
149
187
|
break;
|
|
150
188
|
}
|
|
@@ -19,9 +19,16 @@ export const activate = () => createCommand(state => {
|
|
|
19
19
|
findText = getSelectedText(selection);
|
|
20
20
|
const {
|
|
21
21
|
shouldMatchCase,
|
|
22
|
-
getIntl
|
|
22
|
+
getIntl,
|
|
23
|
+
api
|
|
23
24
|
} = getPluginState(state);
|
|
24
|
-
matches = findMatches(
|
|
25
|
+
matches = findMatches({
|
|
26
|
+
content: state.doc,
|
|
27
|
+
searchText: findText,
|
|
28
|
+
shouldMatchCase,
|
|
29
|
+
getIntl,
|
|
30
|
+
api
|
|
31
|
+
});
|
|
25
32
|
index = findSearchIndex(selection.from, matches);
|
|
26
33
|
}
|
|
27
34
|
return {
|
|
@@ -37,9 +44,16 @@ export const find = (editorView, containerElement, keyword) => withScrollIntoVie
|
|
|
37
44
|
} = state;
|
|
38
45
|
const {
|
|
39
46
|
shouldMatchCase,
|
|
40
|
-
getIntl
|
|
47
|
+
getIntl,
|
|
48
|
+
api
|
|
41
49
|
} = getPluginState(state);
|
|
42
|
-
const matches = keyword !== undefined ? findMatches(
|
|
50
|
+
const matches = keyword !== undefined ? findMatches({
|
|
51
|
+
content: state.doc,
|
|
52
|
+
searchText: keyword,
|
|
53
|
+
shouldMatchCase,
|
|
54
|
+
getIntl,
|
|
55
|
+
api
|
|
56
|
+
}) : [];
|
|
43
57
|
const index = findSearchIndex(selection.from, matches);
|
|
44
58
|
|
|
45
59
|
// we can't just apply all the decorations to highlight the search results at once
|
|
@@ -57,9 +71,16 @@ export const find = (editorView, containerElement, keyword) => withScrollIntoVie
|
|
|
57
71
|
} = state;
|
|
58
72
|
const {
|
|
59
73
|
shouldMatchCase,
|
|
60
|
-
getIntl
|
|
74
|
+
getIntl,
|
|
75
|
+
api
|
|
61
76
|
} = getPluginState(state);
|
|
62
|
-
const matches = keyword !== undefined ? findMatches(
|
|
77
|
+
const matches = keyword !== undefined ? findMatches({
|
|
78
|
+
content: state.doc,
|
|
79
|
+
searchText: keyword,
|
|
80
|
+
shouldMatchCase,
|
|
81
|
+
getIntl,
|
|
82
|
+
api
|
|
83
|
+
}) : [];
|
|
63
84
|
if (matches.length > 0) {
|
|
64
85
|
const index = findSearchIndex(selection.from, matches);
|
|
65
86
|
return tr.setSelection(getSelectionForMatch(tr.selection, tr.doc, index, matches));
|
|
@@ -13,12 +13,13 @@ export const initialState = {
|
|
|
13
13
|
decorationSet: DecorationSet.empty,
|
|
14
14
|
shouldMatchCase: false
|
|
15
15
|
};
|
|
16
|
-
export const createPlugin = (dispatch, getIntl) => {
|
|
16
|
+
export const createPlugin = (dispatch, getIntl, api) => {
|
|
17
17
|
return new SafePlugin({
|
|
18
18
|
key: findReplacePluginKey,
|
|
19
19
|
state: createPluginState(dispatch, () => fg('platform_editor_find_and_replace_part_2') ? {
|
|
20
20
|
...initialState,
|
|
21
|
-
getIntl
|
|
21
|
+
getIntl,
|
|
22
|
+
api
|
|
22
23
|
} : {
|
|
23
24
|
...initialState
|
|
24
25
|
}),
|
|
@@ -25,9 +25,16 @@ const handleDocChanged = (tr, pluginState) => {
|
|
|
25
25
|
decorationSet,
|
|
26
26
|
matches,
|
|
27
27
|
shouldMatchCase,
|
|
28
|
-
getIntl
|
|
28
|
+
getIntl,
|
|
29
|
+
api
|
|
29
30
|
} = pluginState;
|
|
30
|
-
const newMatches = findMatches(
|
|
31
|
+
const newMatches = findMatches({
|
|
32
|
+
content: tr.doc,
|
|
33
|
+
searchText: findText,
|
|
34
|
+
shouldMatchCase: shouldMatchCase,
|
|
35
|
+
getIntl,
|
|
36
|
+
api
|
|
37
|
+
});
|
|
31
38
|
decorationSet = decorationSet.map(tr.mapping, tr.doc);
|
|
32
39
|
const numDecorations = decorationSet.find().length;
|
|
33
40
|
const mappedMatches = matches.map(match => ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
1
2
|
import { FindReplaceActionTypes } from './actions';
|
|
2
3
|
const reducer = getInitialState => (state, action) => {
|
|
3
4
|
switch (action.type) {
|
|
@@ -38,7 +39,15 @@ const reducer = getInitialState => (state, action) => {
|
|
|
38
39
|
index: action.index
|
|
39
40
|
};
|
|
40
41
|
case FindReplaceActionTypes.CANCEL:
|
|
41
|
-
|
|
42
|
+
const {
|
|
43
|
+
getIntl,
|
|
44
|
+
api
|
|
45
|
+
} = state;
|
|
46
|
+
return fg('platform_editor_find_and_replace_part_2') ? {
|
|
47
|
+
...getInitialState(),
|
|
48
|
+
getIntl,
|
|
49
|
+
api
|
|
50
|
+
} : getInitialState();
|
|
42
51
|
case FindReplaceActionTypes.BLUR:
|
|
43
52
|
return {
|
|
44
53
|
...state,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { timestampToString } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
|
|
5
|
+
import { isPromise, MentionNameStatus } from '@atlaskit/mention/types';
|
|
4
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
7
|
import { searchMatchClass, selectedSearchMatchClass } from '../../ui/styles';
|
|
6
8
|
export function getSelectedText(selection) {
|
|
@@ -24,7 +26,14 @@ export const createDecoration = (start, end, isSelected) => {
|
|
|
24
26
|
class: className
|
|
25
27
|
});
|
|
26
28
|
};
|
|
27
|
-
export function findMatches(
|
|
29
|
+
export function findMatches({
|
|
30
|
+
content,
|
|
31
|
+
searchText,
|
|
32
|
+
shouldMatchCase,
|
|
33
|
+
contentIndex = 0,
|
|
34
|
+
getIntl,
|
|
35
|
+
api
|
|
36
|
+
}) {
|
|
28
37
|
const matches = [];
|
|
29
38
|
const searchTextLength = searchText.length;
|
|
30
39
|
let textGrouping = null;
|
|
@@ -88,7 +97,7 @@ export function findMatches(content, searchText, shouldMatchCase, contentIndex =
|
|
|
88
97
|
});
|
|
89
98
|
}
|
|
90
99
|
};
|
|
91
|
-
const
|
|
100
|
+
const collectDateOrMentionMatch = (textGrouping, nodeSize) => {
|
|
92
101
|
if (!textGrouping) {
|
|
93
102
|
return;
|
|
94
103
|
}
|
|
@@ -136,12 +145,43 @@ export function findMatches(content, searchText, shouldMatchCase, contentIndex =
|
|
|
136
145
|
break;
|
|
137
146
|
case 'date':
|
|
138
147
|
if (fg('platform_editor_find_and_replace_part_2')) {
|
|
139
|
-
|
|
148
|
+
collectDateOrMentionMatch({
|
|
140
149
|
text: timestampToString(node.attrs.timestamp, getIntl ? getIntl() : null),
|
|
141
150
|
pos
|
|
142
151
|
}, node.nodeSize);
|
|
143
152
|
}
|
|
144
153
|
break;
|
|
154
|
+
case 'mention':
|
|
155
|
+
if (fg('platform_editor_find_and_replace_part_2')) {
|
|
156
|
+
let text;
|
|
157
|
+
if (node.attrs.text) {
|
|
158
|
+
text = node.attrs.text;
|
|
159
|
+
} else {
|
|
160
|
+
var _api$mention, _api$mention$sharedSt;
|
|
161
|
+
// the text may be sanitised from the node for privacy reasons
|
|
162
|
+
// so we need to use the mentionProvider to resolve it
|
|
163
|
+
const mentionProvider = api === null || api === void 0 ? void 0 : (_api$mention = api.mention) === null || _api$mention === void 0 ? void 0 : (_api$mention$sharedSt = _api$mention.sharedState.currentState()) === null || _api$mention$sharedSt === void 0 ? void 0 : _api$mention$sharedSt.mentionProvider;
|
|
164
|
+
if (isResolvingMentionProvider(mentionProvider)) {
|
|
165
|
+
const nameDetail = mentionProvider.resolveMentionName(node.attrs.id);
|
|
166
|
+
if (isPromise(nameDetail)) {
|
|
167
|
+
text = '@...';
|
|
168
|
+
} else {
|
|
169
|
+
if (nameDetail.status === MentionNameStatus.OK) {
|
|
170
|
+
text = `@${nameDetail.name || ''}`;
|
|
171
|
+
} else {
|
|
172
|
+
text = '@_|unknown|_';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (text) {
|
|
178
|
+
collectDateOrMentionMatch({
|
|
179
|
+
text,
|
|
180
|
+
pos
|
|
181
|
+
}, node.nodeSize);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
145
185
|
default:
|
|
146
186
|
break;
|
|
147
187
|
}
|
|
@@ -61,7 +61,7 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
|
|
|
61
61
|
plugin: function plugin(_ref3) {
|
|
62
62
|
var dispatch = _ref3.dispatch,
|
|
63
63
|
getIntl = _ref3.getIntl;
|
|
64
|
-
return createPlugin(dispatch, getIntl);
|
|
64
|
+
return createPlugin(dispatch, getIntl, api);
|
|
65
65
|
}
|
|
66
66
|
}, {
|
|
67
67
|
name: 'findReplaceKeymap',
|
|
@@ -18,8 +18,15 @@ export var activate = function activate() {
|
|
|
18
18
|
findText = getSelectedText(selection);
|
|
19
19
|
var _getPluginState = getPluginState(state),
|
|
20
20
|
shouldMatchCase = _getPluginState.shouldMatchCase,
|
|
21
|
-
getIntl = _getPluginState.getIntl
|
|
22
|
-
|
|
21
|
+
getIntl = _getPluginState.getIntl,
|
|
22
|
+
api = _getPluginState.api;
|
|
23
|
+
matches = findMatches({
|
|
24
|
+
content: state.doc,
|
|
25
|
+
searchText: findText,
|
|
26
|
+
shouldMatchCase: shouldMatchCase,
|
|
27
|
+
getIntl: getIntl,
|
|
28
|
+
api: api
|
|
29
|
+
});
|
|
23
30
|
index = findSearchIndex(selection.from, matches);
|
|
24
31
|
}
|
|
25
32
|
return {
|
|
@@ -35,8 +42,15 @@ export var find = function find(editorView, containerElement, keyword) {
|
|
|
35
42
|
var selection = state.selection;
|
|
36
43
|
var _getPluginState2 = getPluginState(state),
|
|
37
44
|
shouldMatchCase = _getPluginState2.shouldMatchCase,
|
|
38
|
-
getIntl = _getPluginState2.getIntl
|
|
39
|
-
|
|
45
|
+
getIntl = _getPluginState2.getIntl,
|
|
46
|
+
api = _getPluginState2.api;
|
|
47
|
+
var matches = keyword !== undefined ? findMatches({
|
|
48
|
+
content: state.doc,
|
|
49
|
+
searchText: keyword,
|
|
50
|
+
shouldMatchCase: shouldMatchCase,
|
|
51
|
+
getIntl: getIntl,
|
|
52
|
+
api: api
|
|
53
|
+
}) : [];
|
|
40
54
|
var index = findSearchIndex(selection.from, matches);
|
|
41
55
|
|
|
42
56
|
// we can't just apply all the decorations to highlight the search results at once
|
|
@@ -56,8 +70,15 @@ export var find = function find(editorView, containerElement, keyword) {
|
|
|
56
70
|
var selection = state.selection;
|
|
57
71
|
var _getPluginState3 = getPluginState(state),
|
|
58
72
|
shouldMatchCase = _getPluginState3.shouldMatchCase,
|
|
59
|
-
getIntl = _getPluginState3.getIntl
|
|
60
|
-
|
|
73
|
+
getIntl = _getPluginState3.getIntl,
|
|
74
|
+
api = _getPluginState3.api;
|
|
75
|
+
var matches = keyword !== undefined ? findMatches({
|
|
76
|
+
content: state.doc,
|
|
77
|
+
searchText: keyword,
|
|
78
|
+
shouldMatchCase: shouldMatchCase,
|
|
79
|
+
getIntl: getIntl,
|
|
80
|
+
api: api
|
|
81
|
+
}) : [];
|
|
61
82
|
if (matches.length > 0) {
|
|
62
83
|
var index = findSearchIndex(selection.from, matches);
|
|
63
84
|
return tr.setSelection(getSelectionForMatch(tr.selection, tr.doc, index, matches));
|
|
@@ -16,12 +16,13 @@ export var initialState = {
|
|
|
16
16
|
decorationSet: DecorationSet.empty,
|
|
17
17
|
shouldMatchCase: false
|
|
18
18
|
};
|
|
19
|
-
export var createPlugin = function createPlugin(dispatch, getIntl) {
|
|
19
|
+
export var createPlugin = function createPlugin(dispatch, getIntl, api) {
|
|
20
20
|
return new SafePlugin({
|
|
21
21
|
key: findReplacePluginKey,
|
|
22
22
|
state: createPluginState(dispatch, function () {
|
|
23
23
|
return fg('platform_editor_find_and_replace_part_2') ? _objectSpread(_objectSpread({}, initialState), {}, {
|
|
24
|
-
getIntl: getIntl
|
|
24
|
+
getIntl: getIntl,
|
|
25
|
+
api: api
|
|
25
26
|
}) : _objectSpread({}, initialState);
|
|
26
27
|
}),
|
|
27
28
|
props: {
|
|
@@ -26,8 +26,15 @@ var handleDocChanged = function handleDocChanged(tr, pluginState) {
|
|
|
26
26
|
decorationSet = pluginState.decorationSet,
|
|
27
27
|
matches = pluginState.matches,
|
|
28
28
|
shouldMatchCase = pluginState.shouldMatchCase,
|
|
29
|
-
getIntl = pluginState.getIntl
|
|
30
|
-
|
|
29
|
+
getIntl = pluginState.getIntl,
|
|
30
|
+
api = pluginState.api;
|
|
31
|
+
var newMatches = findMatches({
|
|
32
|
+
content: tr.doc,
|
|
33
|
+
searchText: findText,
|
|
34
|
+
shouldMatchCase: shouldMatchCase,
|
|
35
|
+
getIntl: getIntl,
|
|
36
|
+
api: api
|
|
37
|
+
});
|
|
31
38
|
decorationSet = decorationSet.map(tr.mapping, tr.doc);
|
|
32
39
|
var numDecorations = decorationSet.find().length;
|
|
33
40
|
var mappedMatches = matches.map(function (match) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
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
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { FindReplaceActionTypes } from './actions';
|
|
5
6
|
var reducer = function reducer(getInitialState) {
|
|
6
7
|
return function (state, action) {
|
|
@@ -37,7 +38,12 @@ var reducer = function reducer(getInitialState) {
|
|
|
37
38
|
index: action.index
|
|
38
39
|
});
|
|
39
40
|
case FindReplaceActionTypes.CANCEL:
|
|
40
|
-
|
|
41
|
+
var getIntl = state.getIntl,
|
|
42
|
+
api = state.api;
|
|
43
|
+
return fg('platform_editor_find_and_replace_part_2') ? _objectSpread(_objectSpread({}, getInitialState()), {}, {
|
|
44
|
+
getIntl: getIntl,
|
|
45
|
+
api: api
|
|
46
|
+
}) : getInitialState();
|
|
41
47
|
case FindReplaceActionTypes.BLUR:
|
|
42
48
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
43
49
|
shouldFocus: false
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { timestampToString } from '@atlaskit/editor-common/utils';
|
|
2
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
|
|
5
|
+
import { isPromise, MentionNameStatus } from '@atlaskit/mention/types';
|
|
4
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
7
|
import { searchMatchClass, selectedSearchMatchClass } from '../../ui/styles';
|
|
6
8
|
export function getSelectedText(selection) {
|
|
@@ -27,9 +29,14 @@ export var createDecoration = function createDecoration(start, end, isSelected)
|
|
|
27
29
|
class: className
|
|
28
30
|
});
|
|
29
31
|
};
|
|
30
|
-
export function findMatches(
|
|
31
|
-
var
|
|
32
|
-
|
|
32
|
+
export function findMatches(_ref2) {
|
|
33
|
+
var content = _ref2.content,
|
|
34
|
+
searchText = _ref2.searchText,
|
|
35
|
+
shouldMatchCase = _ref2.shouldMatchCase,
|
|
36
|
+
_ref2$contentIndex = _ref2.contentIndex,
|
|
37
|
+
contentIndex = _ref2$contentIndex === void 0 ? 0 : _ref2$contentIndex,
|
|
38
|
+
getIntl = _ref2.getIntl,
|
|
39
|
+
api = _ref2.api;
|
|
33
40
|
var matches = [];
|
|
34
41
|
var searchTextLength = searchText.length;
|
|
35
42
|
var textGrouping = null;
|
|
@@ -85,7 +92,7 @@ export function findMatches(content, searchText, shouldMatchCase) {
|
|
|
85
92
|
});
|
|
86
93
|
}
|
|
87
94
|
};
|
|
88
|
-
var
|
|
95
|
+
var collectDateOrMentionMatch = function collectDateOrMentionMatch(textGrouping, nodeSize) {
|
|
89
96
|
if (!textGrouping) {
|
|
90
97
|
return;
|
|
91
98
|
}
|
|
@@ -129,12 +136,43 @@ export function findMatches(content, searchText, shouldMatchCase) {
|
|
|
129
136
|
break;
|
|
130
137
|
case 'date':
|
|
131
138
|
if (fg('platform_editor_find_and_replace_part_2')) {
|
|
132
|
-
|
|
139
|
+
collectDateOrMentionMatch({
|
|
133
140
|
text: timestampToString(node.attrs.timestamp, getIntl ? getIntl() : null),
|
|
134
141
|
pos: pos
|
|
135
142
|
}, node.nodeSize);
|
|
136
143
|
}
|
|
137
144
|
break;
|
|
145
|
+
case 'mention':
|
|
146
|
+
if (fg('platform_editor_find_and_replace_part_2')) {
|
|
147
|
+
var text;
|
|
148
|
+
if (node.attrs.text) {
|
|
149
|
+
text = node.attrs.text;
|
|
150
|
+
} else {
|
|
151
|
+
var _api$mention;
|
|
152
|
+
// the text may be sanitised from the node for privacy reasons
|
|
153
|
+
// so we need to use the mentionProvider to resolve it
|
|
154
|
+
var mentionProvider = api === null || api === void 0 || (_api$mention = api.mention) === null || _api$mention === void 0 || (_api$mention = _api$mention.sharedState.currentState()) === null || _api$mention === void 0 ? void 0 : _api$mention.mentionProvider;
|
|
155
|
+
if (isResolvingMentionProvider(mentionProvider)) {
|
|
156
|
+
var nameDetail = mentionProvider.resolveMentionName(node.attrs.id);
|
|
157
|
+
if (isPromise(nameDetail)) {
|
|
158
|
+
text = '@...';
|
|
159
|
+
} else {
|
|
160
|
+
if (nameDetail.status === MentionNameStatus.OK) {
|
|
161
|
+
text = "@".concat(nameDetail.name || '');
|
|
162
|
+
} else {
|
|
163
|
+
text = '@_|unknown|_';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (text) {
|
|
169
|
+
collectDateOrMentionMatch({
|
|
170
|
+
text: text,
|
|
171
|
+
pos: pos
|
|
172
|
+
}, node.nodeSize);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
138
176
|
default:
|
|
139
177
|
break;
|
|
140
178
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
+
import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
|
|
5
6
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
6
7
|
import type { FindReplacePluginState, FindReplaceToolbarButtonActionProps } from './types';
|
|
7
8
|
export type FindReplacePluginOptions = {
|
|
@@ -10,7 +11,8 @@ export type FindReplacePluginOptions = {
|
|
|
10
11
|
};
|
|
11
12
|
export type FindReplacePluginDependencies = [
|
|
12
13
|
OptionalPlugin<AnalyticsPlugin>,
|
|
13
|
-
OptionalPlugin<PrimaryToolbarPlugin
|
|
14
|
+
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
15
|
+
OptionalPlugin<MentionsPlugin>
|
|
14
16
|
];
|
|
15
17
|
export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
|
|
16
18
|
pluginConfiguration: FindReplacePluginOptions;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { FindReplacePlugin } from '../findReplacePluginType';
|
|
4
5
|
import type { FindReplacePluginState } from '../types';
|
|
5
6
|
export declare const initialState: FindReplacePluginState;
|
|
6
|
-
export declare const createPlugin: (dispatch: Dispatch, getIntl: PMPluginFactoryParams['getIntl']) => SafePlugin<FindReplacePluginState>;
|
|
7
|
+
export declare const createPlugin: (dispatch: Dispatch, getIntl: PMPluginFactoryParams['getIntl'], api?: ExtractInjectionAPI<FindReplacePlugin>) => SafePlugin<FindReplacePluginState>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { IntlShape } from 'react-intl-next';
|
|
2
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { Fragment, Node as PmNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import type { ReadonlyTransaction, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
6
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import { FindReplacePlugin } from '../../findReplacePluginType';
|
|
8
10
|
import type { Match } from '../../types';
|
|
9
11
|
export declare function getSelectedText(selection: TextSelection): string;
|
|
10
12
|
export declare const createDecorations: (selectedIndex: number, matches: {
|
|
@@ -12,7 +14,15 @@ export declare const createDecorations: (selectedIndex: number, matches: {
|
|
|
12
14
|
end: number;
|
|
13
15
|
}[]) => Decoration[];
|
|
14
16
|
export declare const createDecoration: (start: number, end: number, isSelected?: boolean) => Decoration;
|
|
15
|
-
|
|
17
|
+
type FindMatchesType = {
|
|
18
|
+
content: PmNode | Fragment;
|
|
19
|
+
searchText: string;
|
|
20
|
+
shouldMatchCase: boolean;
|
|
21
|
+
contentIndex?: number;
|
|
22
|
+
getIntl?: () => IntlShape;
|
|
23
|
+
api?: ExtractInjectionAPI<FindReplacePlugin>;
|
|
24
|
+
};
|
|
25
|
+
export declare function findMatches({ content, searchText, shouldMatchCase, contentIndex, getIntl, api }: FindMatchesType): Match[];
|
|
16
26
|
/**
|
|
17
27
|
* Finds index of first item in matches array that comes after user's cursor pos.
|
|
18
28
|
* If `backward` is `true`, finds index of first item that comes before instead.
|
|
@@ -48,3 +58,4 @@ export declare const isMatchAffectedByStep: (match: Match, step: Step & {
|
|
|
48
58
|
to: number;
|
|
49
59
|
slice: Slice;
|
|
50
60
|
}, tr: ReadonlyTransaction) => boolean;
|
|
61
|
+
export {};
|
|
@@ -25,6 +25,8 @@ export interface FindReplacePluginState {
|
|
|
25
25
|
shouldMatchCase: boolean;
|
|
26
26
|
/** Intl object */
|
|
27
27
|
getIntl?: () => IntlShape;
|
|
28
|
+
/** api */
|
|
29
|
+
api?: ExtractInjectionAPI<FindReplacePlugin>;
|
|
28
30
|
}
|
|
29
31
|
export type FindReplaceToolbarButtonWithStateProps = {
|
|
30
32
|
popupsBoundariesElement?: HTMLElement;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
+
import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
|
|
5
6
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
6
7
|
import type { FindReplacePluginState, FindReplaceToolbarButtonActionProps } from './types';
|
|
7
8
|
export type FindReplacePluginOptions = {
|
|
@@ -10,7 +11,8 @@ export type FindReplacePluginOptions = {
|
|
|
10
11
|
};
|
|
11
12
|
export type FindReplacePluginDependencies = [
|
|
12
13
|
OptionalPlugin<AnalyticsPlugin>,
|
|
13
|
-
OptionalPlugin<PrimaryToolbarPlugin
|
|
14
|
+
OptionalPlugin<PrimaryToolbarPlugin>,
|
|
15
|
+
OptionalPlugin<MentionsPlugin>
|
|
14
16
|
];
|
|
15
17
|
export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
|
|
16
18
|
pluginConfiguration: FindReplacePluginOptions;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
4
|
+
import { FindReplacePlugin } from '../findReplacePluginType';
|
|
4
5
|
import type { FindReplacePluginState } from '../types';
|
|
5
6
|
export declare const initialState: FindReplacePluginState;
|
|
6
|
-
export declare const createPlugin: (dispatch: Dispatch, getIntl: PMPluginFactoryParams['getIntl']) => SafePlugin<FindReplacePluginState>;
|
|
7
|
+
export declare const createPlugin: (dispatch: Dispatch, getIntl: PMPluginFactoryParams['getIntl'], api?: ExtractInjectionAPI<FindReplacePlugin>) => SafePlugin<FindReplacePluginState>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { IntlShape } from 'react-intl-next';
|
|
2
|
+
import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { Fragment, Node as PmNode, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
4
|
import type { ReadonlyTransaction, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
5
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import type { Step } from '@atlaskit/editor-prosemirror/transform';
|
|
6
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
8
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import { FindReplacePlugin } from '../../findReplacePluginType';
|
|
8
10
|
import type { Match } from '../../types';
|
|
9
11
|
export declare function getSelectedText(selection: TextSelection): string;
|
|
10
12
|
export declare const createDecorations: (selectedIndex: number, matches: {
|
|
@@ -12,7 +14,15 @@ export declare const createDecorations: (selectedIndex: number, matches: {
|
|
|
12
14
|
end: number;
|
|
13
15
|
}[]) => Decoration[];
|
|
14
16
|
export declare const createDecoration: (start: number, end: number, isSelected?: boolean) => Decoration;
|
|
15
|
-
|
|
17
|
+
type FindMatchesType = {
|
|
18
|
+
content: PmNode | Fragment;
|
|
19
|
+
searchText: string;
|
|
20
|
+
shouldMatchCase: boolean;
|
|
21
|
+
contentIndex?: number;
|
|
22
|
+
getIntl?: () => IntlShape;
|
|
23
|
+
api?: ExtractInjectionAPI<FindReplacePlugin>;
|
|
24
|
+
};
|
|
25
|
+
export declare function findMatches({ content, searchText, shouldMatchCase, contentIndex, getIntl, api }: FindMatchesType): Match[];
|
|
16
26
|
/**
|
|
17
27
|
* Finds index of first item in matches array that comes after user's cursor pos.
|
|
18
28
|
* If `backward` is `true`, finds index of first item that comes before instead.
|
|
@@ -48,3 +58,4 @@ export declare const isMatchAffectedByStep: (match: Match, step: Step & {
|
|
|
48
58
|
to: number;
|
|
49
59
|
slice: Slice;
|
|
50
60
|
}, tr: ReadonlyTransaction) => boolean;
|
|
61
|
+
export {};
|
|
@@ -25,6 +25,8 @@ export interface FindReplacePluginState {
|
|
|
25
25
|
shouldMatchCase: boolean;
|
|
26
26
|
/** Intl object */
|
|
27
27
|
getIntl?: () => IntlShape;
|
|
28
|
+
/** api */
|
|
29
|
+
api?: ExtractInjectionAPI<FindReplacePlugin>;
|
|
28
30
|
}
|
|
29
31
|
export type FindReplaceToolbarButtonWithStateProps = {
|
|
30
32
|
popupsBoundariesElement?: 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.7.0",
|
|
4
4
|
"description": "find replace plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,17 +35,19 @@
|
|
|
35
35
|
"@atlaskit/button": "^23.2.0",
|
|
36
36
|
"@atlaskit/editor-common": "^107.0.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
38
|
+
"@atlaskit/editor-plugin-mentions": "^4.7.0",
|
|
38
39
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
|
|
39
40
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
41
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
41
42
|
"@atlaskit/form": "^12.0.0",
|
|
42
43
|
"@atlaskit/icon": "^27.0.0",
|
|
44
|
+
"@atlaskit/mention": "^24.2.0",
|
|
43
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
|
-
"@atlaskit/primitives": "^14.
|
|
46
|
+
"@atlaskit/primitives": "^14.9.0",
|
|
45
47
|
"@atlaskit/textfield": "^8.0.0",
|
|
46
48
|
"@atlaskit/theme": "^18.0.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^7.
|
|
48
|
-
"@atlaskit/tokens": "^5.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^7.2.0",
|
|
50
|
+
"@atlaskit/tokens": "^5.3.0",
|
|
49
51
|
"@atlaskit/tooltip": "^20.3.0",
|
|
50
52
|
"@babel/runtime": "^7.0.0",
|
|
51
53
|
"@emotion/react": "^11.7.1",
|