@atlaskit/editor-plugin-mentions 12.2.8 → 12.2.9
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 +18 -0
- package/dist/cjs/mentionsPlugin.js +8 -8
- package/dist/cjs/nodeviews/mentionNodeView.js +9 -9
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/ProfileCardComponent.js +17 -17
- package/dist/cjs/ui/type-ahead/index.js +42 -19
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/type-ahead/index.js +22 -0
- package/dist/esm/mentionsPlugin.js +8 -8
- package/dist/esm/nodeviews/mentionNodeView.js +9 -9
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/ProfileCardComponent.js +16 -16
- package/dist/esm/ui/type-ahead/index.js +42 -19
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 12.2.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`beab4fffee103`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/beab4fffee103) -
|
|
8
|
+
EDITOR-7318: Add type-ahead sections support with getSections handler API.
|
|
9
|
+
|
|
10
|
+
Adds `TypeAheadSection` and `TypeAheadSectionUpdate` types and an optional `getSections()` method
|
|
11
|
+
to `TypeAheadHandler` in `editor-common`. Implements section grouping in
|
|
12
|
+
`editor-plugin-type-ahead` via `buildSectionedResult`. Adds People/Agents section split to
|
|
13
|
+
`editor-plugin-mentions`.
|
|
14
|
+
|
|
15
|
+
Removes the `updateSection` action and associated `sectionOverrides`/`sectionsRefreshKey`
|
|
16
|
+
pm-plugin state — section definitions are now derived directly from `getSections()` at load time
|
|
17
|
+
rather than being mutated at runtime.
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 12.2.8
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -199,25 +199,25 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
199
199
|
var _setProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(providerPromise) {
|
|
200
200
|
var _api$core$actions$exe;
|
|
201
201
|
var provider;
|
|
202
|
-
return _regenerator.default.wrap(function
|
|
202
|
+
return _regenerator.default.wrap(function (_context) {
|
|
203
203
|
while (1) switch (_context.prev = _context.next) {
|
|
204
204
|
case 0:
|
|
205
205
|
if ((0, _platformFeatureFlags.fg)('platform_editor_mention_provider_via_plugin_config')) {
|
|
206
|
-
_context.next =
|
|
206
|
+
_context.next = 1;
|
|
207
207
|
break;
|
|
208
208
|
}
|
|
209
209
|
return _context.abrupt("return", false);
|
|
210
|
-
case
|
|
211
|
-
_context.next =
|
|
210
|
+
case 1:
|
|
211
|
+
_context.next = 2;
|
|
212
212
|
return providerPromise;
|
|
213
|
-
case
|
|
213
|
+
case 2:
|
|
214
214
|
provider = _context.sent;
|
|
215
215
|
if (!(previousMediaProvider === provider)) {
|
|
216
|
-
_context.next =
|
|
216
|
+
_context.next = 3;
|
|
217
217
|
break;
|
|
218
218
|
}
|
|
219
219
|
return _context.abrupt("return", false);
|
|
220
|
-
case
|
|
220
|
+
case 3:
|
|
221
221
|
previousMediaProvider = provider;
|
|
222
222
|
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref7) {
|
|
223
223
|
var tr = _ref7.tr;
|
|
@@ -228,7 +228,7 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
228
228
|
}
|
|
229
229
|
});
|
|
230
230
|
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
231
|
-
case
|
|
231
|
+
case 4:
|
|
232
232
|
case "end":
|
|
233
233
|
return _context.stop();
|
|
234
234
|
}
|
|
@@ -65,20 +65,20 @@ var processName = function processName(name) {
|
|
|
65
65
|
var handleProviderName = /*#__PURE__*/function () {
|
|
66
66
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(mentionProvider, node) {
|
|
67
67
|
var nameDetail, resolvedNameDetail;
|
|
68
|
-
return _regenerator.default.wrap(function
|
|
68
|
+
return _regenerator.default.wrap(function (_context) {
|
|
69
69
|
while (1) switch (_context.prev = _context.next) {
|
|
70
70
|
case 0:
|
|
71
71
|
if (!((0, _resource.isResolvingMentionProvider)(mentionProvider) && node.attrs.id && !node.attrs.text)) {
|
|
72
|
-
_context.next =
|
|
72
|
+
_context.next = 2;
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
75
|
nameDetail = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.resolveMentionName(node.attrs.id);
|
|
76
|
-
_context.next =
|
|
76
|
+
_context.next = 1;
|
|
77
77
|
return nameDetail;
|
|
78
|
-
case
|
|
78
|
+
case 1:
|
|
79
79
|
resolvedNameDetail = _context.sent;
|
|
80
80
|
return _context.abrupt("return", processName(resolvedNameDetail));
|
|
81
|
-
case
|
|
81
|
+
case 2:
|
|
82
82
|
case "end":
|
|
83
83
|
return _context.stop();
|
|
84
84
|
}
|
|
@@ -181,7 +181,7 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
|
|
|
181
181
|
var _updateState = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(mentionProvider) {
|
|
182
182
|
var _mentionProvider$shou2, _this$config$options2;
|
|
183
183
|
var isHighlighted, newState, name;
|
|
184
|
-
return _regenerator.default.wrap(function
|
|
184
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
185
185
|
while (1) switch (_context2.prev = _context2.next) {
|
|
186
186
|
case 0:
|
|
187
187
|
isHighlighted = (0, _expValEquals.expValEquals)('platform_editor_vc90_transition_mentions', 'isEnabled', true) ? this.shouldHighlightMention(mentionProvider) : (_mentionProvider$shou2 = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.shouldHighlightMention({
|
|
@@ -192,15 +192,15 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
|
|
|
192
192
|
this.setClassList(newState);
|
|
193
193
|
this.state = newState;
|
|
194
194
|
}
|
|
195
|
-
_context2.next =
|
|
195
|
+
_context2.next = 1;
|
|
196
196
|
return handleProviderName(mentionProvider, this.node);
|
|
197
|
-
case
|
|
197
|
+
case 1:
|
|
198
198
|
name = _context2.sent;
|
|
199
199
|
this.setTextContent(name);
|
|
200
200
|
if (name && this.domElement && (_this$config$options2 = this.config.options) !== null && _this$config$options2 !== void 0 && _this$config$options2.profilecardProvider) {
|
|
201
201
|
this.domElement.setAttribute('aria-label', getAccessibilityLabelFromName(name));
|
|
202
202
|
}
|
|
203
|
-
case
|
|
203
|
+
case 2:
|
|
204
204
|
case "end":
|
|
205
205
|
return _context2.stop();
|
|
206
206
|
}
|
|
@@ -23,7 +23,7 @@ var ACTIONS = exports.ACTIONS = {
|
|
|
23
23
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
24
24
|
};
|
|
25
25
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
26
|
-
var PACKAGE_VERSION = "12.2.
|
|
26
|
+
var PACKAGE_VERSION = "12.2.8";
|
|
27
27
|
var setProvider = function setProvider(provider) {
|
|
28
28
|
return function (state, dispatch) {
|
|
29
29
|
if (dispatch) {
|
|
@@ -19,7 +19,7 @@ var _bindEventListener = require("bind-event-listener");
|
|
|
19
19
|
var _user = require("@atlaskit/profilecard/user");
|
|
20
20
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
21
21
|
var _PopperWrapper = require("./PopperWrapper");
|
|
22
|
-
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
|
|
22
|
+
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 _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
23
23
|
var styles = {
|
|
24
24
|
loadingStyles: "_2rko12b0 _16qs130s"
|
|
25
25
|
};
|
|
@@ -62,24 +62,24 @@ var useProfileCardState = exports.useProfileCardState = function useProfileCardS
|
|
|
62
62
|
(0, _react.useEffect)(function () {
|
|
63
63
|
var fetchData = /*#__PURE__*/function () {
|
|
64
64
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
65
|
-
var _yield$Promise$all, _yield$Promise$all2, _data, reportingLines, shouldGiveKudos, _teamCentralBaseUrl;
|
|
66
|
-
return _regenerator.default.wrap(function
|
|
65
|
+
var _yield$Promise$all, _yield$Promise$all2, _data, reportingLines, shouldGiveKudos, _teamCentralBaseUrl, _t;
|
|
66
|
+
return _regenerator.default.wrap(function (_context) {
|
|
67
67
|
while (1) switch (_context.prev = _context.next) {
|
|
68
68
|
case 0:
|
|
69
69
|
if (!(!id || !provider)) {
|
|
70
|
-
_context.next =
|
|
70
|
+
_context.next = 1;
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
return _context.abrupt("return");
|
|
74
|
-
case
|
|
74
|
+
case 1:
|
|
75
75
|
setIsLoading(true);
|
|
76
|
-
_context.prev =
|
|
77
|
-
_context.next =
|
|
76
|
+
_context.prev = 2;
|
|
77
|
+
_context.next = 3;
|
|
78
78
|
return Promise.all([provider === null || provider === void 0 ? void 0 : provider.resourceClient.getProfile((provider === null || provider === void 0 ? void 0 : provider.cloudId) || '', id, function () {}), provider === null || provider === void 0 ? void 0 : provider.resourceClient.getReportingLines(id), provider === null || provider === void 0 ? void 0 : provider.resourceClient.shouldShowGiveKudos(), provider === null || provider === void 0 ? void 0 : provider.resourceClient.getTeamCentralBaseUrl({
|
|
79
79
|
withOrgContext: true,
|
|
80
80
|
withSiteContext: true
|
|
81
81
|
})]);
|
|
82
|
-
case
|
|
82
|
+
case 3:
|
|
83
83
|
_yield$Promise$all = _context.sent;
|
|
84
84
|
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 4);
|
|
85
85
|
_data = _yield$Promise$all2[0];
|
|
@@ -91,21 +91,21 @@ var useProfileCardState = exports.useProfileCardState = function useProfileCardS
|
|
|
91
91
|
setShouldShowGiveKudos(shouldGiveKudos !== null && shouldGiveKudos !== void 0 ? shouldGiveKudos : false);
|
|
92
92
|
setTeamCentralBaseUrl(_teamCentralBaseUrl);
|
|
93
93
|
setHasError(false);
|
|
94
|
-
_context.next =
|
|
94
|
+
_context.next = 5;
|
|
95
95
|
break;
|
|
96
|
-
case
|
|
97
|
-
_context.prev =
|
|
98
|
-
|
|
96
|
+
case 4:
|
|
97
|
+
_context.prev = 4;
|
|
98
|
+
_t = _context["catch"](2);
|
|
99
99
|
setHasError(true);
|
|
100
|
-
case
|
|
101
|
-
_context.prev =
|
|
100
|
+
case 5:
|
|
101
|
+
_context.prev = 5;
|
|
102
102
|
setIsLoading(false);
|
|
103
|
-
return _context.finish(
|
|
104
|
-
case
|
|
103
|
+
return _context.finish(5);
|
|
104
|
+
case 6:
|
|
105
105
|
case "end":
|
|
106
106
|
return _context.stop();
|
|
107
107
|
}
|
|
108
|
-
}, _callee, null, [[
|
|
108
|
+
}, _callee, null, [[2, 4, 5, 6]]);
|
|
109
109
|
}));
|
|
110
110
|
return function fetchData() {
|
|
111
111
|
return _ref3.apply(this, arguments);
|
|
@@ -12,6 +12,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
12
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
15
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
15
16
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
16
17
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
17
18
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
@@ -32,6 +33,9 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
32
33
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
33
34
|
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; }
|
|
34
35
|
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; } // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
36
|
+
var isAgentType = function isAgentType(userType) {
|
|
37
|
+
return userType === 'APP' || userType === 'AGENT';
|
|
38
|
+
};
|
|
35
39
|
var createInviteItem = function createInviteItem(_ref) {
|
|
36
40
|
var mentionProvider = _ref.mentionProvider,
|
|
37
41
|
onInviteItemMount = _ref.onInviteItemMount,
|
|
@@ -314,27 +318,46 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
314
318
|
}));
|
|
315
319
|
});
|
|
316
320
|
},
|
|
321
|
+
getSections: function getSections(_ref9) {
|
|
322
|
+
var intl = _ref9.intl;
|
|
323
|
+
return [{
|
|
324
|
+
id: 'people',
|
|
325
|
+
title: intl.formatMessage(_messages.mentionMessages.typeAheadSectionPeople),
|
|
326
|
+
filter: function filter(item) {
|
|
327
|
+
var _item$mention;
|
|
328
|
+
return !isAgentType(((_item$mention = item.mention) === null || _item$mention === void 0 ? void 0 : _item$mention.userType) || '');
|
|
329
|
+
},
|
|
330
|
+
limit: 6
|
|
331
|
+
}, {
|
|
332
|
+
id: 'agents',
|
|
333
|
+
title: intl.formatMessage(_messages.mentionMessages.typeAheadSectionAgents),
|
|
334
|
+
filter: function filter(item) {
|
|
335
|
+
var _item$mention2;
|
|
336
|
+
return isAgentType(((_item$mention2 = item.mention) === null || _item$mention2 === void 0 ? void 0 : _item$mention2.userType) || '');
|
|
337
|
+
}
|
|
338
|
+
}];
|
|
339
|
+
},
|
|
317
340
|
onOpen: function onOpen() {
|
|
318
341
|
firstQueryWithoutResults = null;
|
|
319
342
|
},
|
|
320
|
-
selectItem: function selectItem(state, item, insert,
|
|
343
|
+
selectItem: function selectItem(state, item, insert, _ref0) {
|
|
321
344
|
var _api$contextIdentifie3, _api$contextIdentifie4;
|
|
322
|
-
var mode =
|
|
323
|
-
stats =
|
|
324
|
-
query =
|
|
325
|
-
sourceListItem =
|
|
345
|
+
var mode = _ref0.mode,
|
|
346
|
+
stats = _ref0.stats,
|
|
347
|
+
query = _ref0.query,
|
|
348
|
+
sourceListItem = _ref0.sourceListItem;
|
|
326
349
|
var schema = state.schema;
|
|
327
350
|
var pluginState = (0, _utils2.getMentionPluginState)(state);
|
|
328
351
|
var mentionProvider = pluginState.mentionProvider;
|
|
329
|
-
var _item$
|
|
330
|
-
id = _item$
|
|
331
|
-
name = _item$
|
|
332
|
-
nickname = _item$
|
|
333
|
-
accessLevel = _item$
|
|
334
|
-
userType = _item$
|
|
335
|
-
isXProductUser = _item$
|
|
336
|
-
var
|
|
337
|
-
contextIdentifierProvider =
|
|
352
|
+
var _item$mention3 = item.mention,
|
|
353
|
+
id = _item$mention3.id,
|
|
354
|
+
name = _item$mention3.name,
|
|
355
|
+
nickname = _item$mention3.nickname,
|
|
356
|
+
accessLevel = _item$mention3.accessLevel,
|
|
357
|
+
userType = _item$mention3.userType,
|
|
358
|
+
isXProductUser = _item$mention3.isXProductUser;
|
|
359
|
+
var _ref1 = (_api$contextIdentifie3 = api === null || api === void 0 || (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {},
|
|
360
|
+
contextIdentifierProvider = _ref1.contextIdentifierProvider;
|
|
338
361
|
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
339
362
|
sessionId: sessionId
|
|
340
363
|
});
|
|
@@ -433,11 +456,11 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
433
456
|
isXProductUser: isXProductUser
|
|
434
457
|
}));
|
|
435
458
|
},
|
|
436
|
-
dismiss: function dismiss(
|
|
437
|
-
var editorState =
|
|
438
|
-
query =
|
|
439
|
-
stats =
|
|
440
|
-
wasItemInserted =
|
|
459
|
+
dismiss: function dismiss(_ref10) {
|
|
460
|
+
var editorState = _ref10.editorState,
|
|
461
|
+
query = _ref10.query,
|
|
462
|
+
stats = _ref10.stats,
|
|
463
|
+
wasItemInserted = _ref10.wasItemInserted;
|
|
441
464
|
firstQueryWithoutResults = null;
|
|
442
465
|
var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
|
|
443
466
|
if (!wasItemInserted) {
|
|
@@ -12,7 +12,7 @@ export const ACTIONS = {
|
|
|
12
12
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
13
13
|
};
|
|
14
14
|
const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
15
|
-
const PACKAGE_VERSION = "12.2.
|
|
15
|
+
const PACKAGE_VERSION = "12.2.8";
|
|
16
16
|
const setProvider = provider => (state, dispatch) => {
|
|
17
17
|
if (dispatch) {
|
|
18
18
|
dispatch(state.tr.setMeta(mentionPluginKey, {
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
4
4
|
import uuid from 'uuid';
|
|
5
|
+
import { mentionMessages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
6
7
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
7
8
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -16,6 +17,7 @@ import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
|
16
17
|
import InviteItemWithEmailDomain from '../InviteItem/InviteItemWithEmailDomain';
|
|
17
18
|
import { buildTypeAheadCancelPayload, buildTypeAheadInsertedPayload, buildTypeAheadInviteItemClickedPayload, buildTypeAheadInviteItemViewedPayload, buildTypeAheadRenderedPayload } from './analytics';
|
|
18
19
|
import { isInviteItem, isTeamStats, isTeamType, shouldKeepInviteItem } from './utils';
|
|
20
|
+
const isAgentType = userType => userType === 'APP' || userType === 'AGENT';
|
|
19
21
|
const createInviteItem = ({
|
|
20
22
|
mentionProvider,
|
|
21
23
|
onInviteItemMount,
|
|
@@ -295,6 +297,26 @@ export const createTypeAheadConfig = ({
|
|
|
295
297
|
});
|
|
296
298
|
});
|
|
297
299
|
},
|
|
300
|
+
getSections({
|
|
301
|
+
intl
|
|
302
|
+
}) {
|
|
303
|
+
return [{
|
|
304
|
+
id: 'people',
|
|
305
|
+
title: intl.formatMessage(mentionMessages.typeAheadSectionPeople),
|
|
306
|
+
filter: item => {
|
|
307
|
+
var _item$mention;
|
|
308
|
+
return !isAgentType(((_item$mention = item.mention) === null || _item$mention === void 0 ? void 0 : _item$mention.userType) || '');
|
|
309
|
+
},
|
|
310
|
+
limit: 6
|
|
311
|
+
}, {
|
|
312
|
+
id: 'agents',
|
|
313
|
+
title: intl.formatMessage(mentionMessages.typeAheadSectionAgents),
|
|
314
|
+
filter: item => {
|
|
315
|
+
var _item$mention2;
|
|
316
|
+
return isAgentType(((_item$mention2 = item.mention) === null || _item$mention2 === void 0 ? void 0 : _item$mention2.userType) || '');
|
|
317
|
+
}
|
|
318
|
+
}];
|
|
319
|
+
},
|
|
298
320
|
onOpen: () => {
|
|
299
321
|
firstQueryWithoutResults = null;
|
|
300
322
|
},
|
|
@@ -191,25 +191,25 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
191
191
|
var _setProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(providerPromise) {
|
|
192
192
|
var _api$core$actions$exe;
|
|
193
193
|
var provider;
|
|
194
|
-
return _regeneratorRuntime.wrap(function
|
|
194
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
195
195
|
while (1) switch (_context.prev = _context.next) {
|
|
196
196
|
case 0:
|
|
197
197
|
if (fg('platform_editor_mention_provider_via_plugin_config')) {
|
|
198
|
-
_context.next =
|
|
198
|
+
_context.next = 1;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
return _context.abrupt("return", false);
|
|
202
|
-
case
|
|
203
|
-
_context.next =
|
|
202
|
+
case 1:
|
|
203
|
+
_context.next = 2;
|
|
204
204
|
return providerPromise;
|
|
205
|
-
case
|
|
205
|
+
case 2:
|
|
206
206
|
provider = _context.sent;
|
|
207
207
|
if (!(previousMediaProvider === provider)) {
|
|
208
|
-
_context.next =
|
|
208
|
+
_context.next = 3;
|
|
209
209
|
break;
|
|
210
210
|
}
|
|
211
211
|
return _context.abrupt("return", false);
|
|
212
|
-
case
|
|
212
|
+
case 3:
|
|
213
213
|
previousMediaProvider = provider;
|
|
214
214
|
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref7) {
|
|
215
215
|
var tr = _ref7.tr;
|
|
@@ -220,7 +220,7 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
223
|
-
case
|
|
223
|
+
case 4:
|
|
224
224
|
case "end":
|
|
225
225
|
return _context.stop();
|
|
226
226
|
}
|
|
@@ -58,20 +58,20 @@ var processName = function processName(name) {
|
|
|
58
58
|
var handleProviderName = /*#__PURE__*/function () {
|
|
59
59
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(mentionProvider, node) {
|
|
60
60
|
var nameDetail, resolvedNameDetail;
|
|
61
|
-
return _regeneratorRuntime.wrap(function
|
|
61
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
62
62
|
while (1) switch (_context.prev = _context.next) {
|
|
63
63
|
case 0:
|
|
64
64
|
if (!(isResolvingMentionProvider(mentionProvider) && node.attrs.id && !node.attrs.text)) {
|
|
65
|
-
_context.next =
|
|
65
|
+
_context.next = 2;
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
nameDetail = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.resolveMentionName(node.attrs.id);
|
|
69
|
-
_context.next =
|
|
69
|
+
_context.next = 1;
|
|
70
70
|
return nameDetail;
|
|
71
|
-
case
|
|
71
|
+
case 1:
|
|
72
72
|
resolvedNameDetail = _context.sent;
|
|
73
73
|
return _context.abrupt("return", processName(resolvedNameDetail));
|
|
74
|
-
case
|
|
74
|
+
case 2:
|
|
75
75
|
case "end":
|
|
76
76
|
return _context.stop();
|
|
77
77
|
}
|
|
@@ -174,7 +174,7 @@ export var MentionNodeView = /*#__PURE__*/function () {
|
|
|
174
174
|
var _updateState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(mentionProvider) {
|
|
175
175
|
var _mentionProvider$shou2, _this$config$options2;
|
|
176
176
|
var isHighlighted, newState, name;
|
|
177
|
-
return _regeneratorRuntime.wrap(function
|
|
177
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
178
178
|
while (1) switch (_context2.prev = _context2.next) {
|
|
179
179
|
case 0:
|
|
180
180
|
isHighlighted = expValEquals('platform_editor_vc90_transition_mentions', 'isEnabled', true) ? this.shouldHighlightMention(mentionProvider) : (_mentionProvider$shou2 = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.shouldHighlightMention({
|
|
@@ -185,15 +185,15 @@ export var MentionNodeView = /*#__PURE__*/function () {
|
|
|
185
185
|
this.setClassList(newState);
|
|
186
186
|
this.state = newState;
|
|
187
187
|
}
|
|
188
|
-
_context2.next =
|
|
188
|
+
_context2.next = 1;
|
|
189
189
|
return handleProviderName(mentionProvider, this.node);
|
|
190
|
-
case
|
|
190
|
+
case 1:
|
|
191
191
|
name = _context2.sent;
|
|
192
192
|
this.setTextContent(name);
|
|
193
193
|
if (name && this.domElement && (_this$config$options2 = this.config.options) !== null && _this$config$options2 !== void 0 && _this$config$options2.profilecardProvider) {
|
|
194
194
|
this.domElement.setAttribute('aria-label', getAccessibilityLabelFromName(name));
|
|
195
195
|
}
|
|
196
|
-
case
|
|
196
|
+
case 2:
|
|
197
197
|
case "end":
|
|
198
198
|
return _context2.stop();
|
|
199
199
|
}
|
|
@@ -15,7 +15,7 @@ export var ACTIONS = {
|
|
|
15
15
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
16
16
|
};
|
|
17
17
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
18
|
-
var PACKAGE_VERSION = "12.2.
|
|
18
|
+
var PACKAGE_VERSION = "12.2.8";
|
|
19
19
|
var setProvider = function setProvider(provider) {
|
|
20
20
|
return function (state, dispatch) {
|
|
21
21
|
if (dispatch) {
|
|
@@ -52,24 +52,24 @@ export var useProfileCardState = function useProfileCardState(_ref2) {
|
|
|
52
52
|
useEffect(function () {
|
|
53
53
|
var fetchData = /*#__PURE__*/function () {
|
|
54
54
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
55
|
-
var _yield$Promise$all, _yield$Promise$all2, _data, reportingLines, shouldGiveKudos, _teamCentralBaseUrl;
|
|
56
|
-
return _regeneratorRuntime.wrap(function
|
|
55
|
+
var _yield$Promise$all, _yield$Promise$all2, _data, reportingLines, shouldGiveKudos, _teamCentralBaseUrl, _t;
|
|
56
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
57
57
|
while (1) switch (_context.prev = _context.next) {
|
|
58
58
|
case 0:
|
|
59
59
|
if (!(!id || !provider)) {
|
|
60
|
-
_context.next =
|
|
60
|
+
_context.next = 1;
|
|
61
61
|
break;
|
|
62
62
|
}
|
|
63
63
|
return _context.abrupt("return");
|
|
64
|
-
case
|
|
64
|
+
case 1:
|
|
65
65
|
setIsLoading(true);
|
|
66
|
-
_context.prev =
|
|
67
|
-
_context.next =
|
|
66
|
+
_context.prev = 2;
|
|
67
|
+
_context.next = 3;
|
|
68
68
|
return Promise.all([provider === null || provider === void 0 ? void 0 : provider.resourceClient.getProfile((provider === null || provider === void 0 ? void 0 : provider.cloudId) || '', id, function () {}), provider === null || provider === void 0 ? void 0 : provider.resourceClient.getReportingLines(id), provider === null || provider === void 0 ? void 0 : provider.resourceClient.shouldShowGiveKudos(), provider === null || provider === void 0 ? void 0 : provider.resourceClient.getTeamCentralBaseUrl({
|
|
69
69
|
withOrgContext: true,
|
|
70
70
|
withSiteContext: true
|
|
71
71
|
})]);
|
|
72
|
-
case
|
|
72
|
+
case 3:
|
|
73
73
|
_yield$Promise$all = _context.sent;
|
|
74
74
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 4);
|
|
75
75
|
_data = _yield$Promise$all2[0];
|
|
@@ -81,21 +81,21 @@ export var useProfileCardState = function useProfileCardState(_ref2) {
|
|
|
81
81
|
setShouldShowGiveKudos(shouldGiveKudos !== null && shouldGiveKudos !== void 0 ? shouldGiveKudos : false);
|
|
82
82
|
setTeamCentralBaseUrl(_teamCentralBaseUrl);
|
|
83
83
|
setHasError(false);
|
|
84
|
-
_context.next =
|
|
84
|
+
_context.next = 5;
|
|
85
85
|
break;
|
|
86
|
-
case
|
|
87
|
-
_context.prev =
|
|
88
|
-
|
|
86
|
+
case 4:
|
|
87
|
+
_context.prev = 4;
|
|
88
|
+
_t = _context["catch"](2);
|
|
89
89
|
setHasError(true);
|
|
90
|
-
case
|
|
91
|
-
_context.prev =
|
|
90
|
+
case 5:
|
|
91
|
+
_context.prev = 5;
|
|
92
92
|
setIsLoading(false);
|
|
93
|
-
return _context.finish(
|
|
94
|
-
case
|
|
93
|
+
return _context.finish(5);
|
|
94
|
+
case 6:
|
|
95
95
|
case "end":
|
|
96
96
|
return _context.stop();
|
|
97
97
|
}
|
|
98
|
-
}, _callee, null, [[
|
|
98
|
+
}, _callee, null, [[2, 4, 5, 6]]);
|
|
99
99
|
}));
|
|
100
100
|
return function fetchData() {
|
|
101
101
|
return _ref3.apply(this, arguments);
|
|
@@ -9,6 +9,7 @@ import React from 'react';
|
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
11
11
|
import uuid from 'uuid';
|
|
12
|
+
import { mentionMessages } from '@atlaskit/editor-common/messages';
|
|
12
13
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
13
14
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
14
15
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -23,6 +24,9 @@ import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
|
23
24
|
import InviteItemWithEmailDomain from '../InviteItem/InviteItemWithEmailDomain';
|
|
24
25
|
import { buildTypeAheadCancelPayload, buildTypeAheadInsertedPayload, buildTypeAheadInviteItemClickedPayload, buildTypeAheadInviteItemViewedPayload, buildTypeAheadRenderedPayload } from './analytics';
|
|
25
26
|
import { isInviteItem, isTeamStats, isTeamType, shouldKeepInviteItem } from './utils';
|
|
27
|
+
var isAgentType = function isAgentType(userType) {
|
|
28
|
+
return userType === 'APP' || userType === 'AGENT';
|
|
29
|
+
};
|
|
26
30
|
var createInviteItem = function createInviteItem(_ref) {
|
|
27
31
|
var mentionProvider = _ref.mentionProvider,
|
|
28
32
|
onInviteItemMount = _ref.onInviteItemMount,
|
|
@@ -305,27 +309,46 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
305
309
|
}));
|
|
306
310
|
});
|
|
307
311
|
},
|
|
312
|
+
getSections: function getSections(_ref9) {
|
|
313
|
+
var intl = _ref9.intl;
|
|
314
|
+
return [{
|
|
315
|
+
id: 'people',
|
|
316
|
+
title: intl.formatMessage(mentionMessages.typeAheadSectionPeople),
|
|
317
|
+
filter: function filter(item) {
|
|
318
|
+
var _item$mention;
|
|
319
|
+
return !isAgentType(((_item$mention = item.mention) === null || _item$mention === void 0 ? void 0 : _item$mention.userType) || '');
|
|
320
|
+
},
|
|
321
|
+
limit: 6
|
|
322
|
+
}, {
|
|
323
|
+
id: 'agents',
|
|
324
|
+
title: intl.formatMessage(mentionMessages.typeAheadSectionAgents),
|
|
325
|
+
filter: function filter(item) {
|
|
326
|
+
var _item$mention2;
|
|
327
|
+
return isAgentType(((_item$mention2 = item.mention) === null || _item$mention2 === void 0 ? void 0 : _item$mention2.userType) || '');
|
|
328
|
+
}
|
|
329
|
+
}];
|
|
330
|
+
},
|
|
308
331
|
onOpen: function onOpen() {
|
|
309
332
|
firstQueryWithoutResults = null;
|
|
310
333
|
},
|
|
311
|
-
selectItem: function selectItem(state, item, insert,
|
|
334
|
+
selectItem: function selectItem(state, item, insert, _ref0) {
|
|
312
335
|
var _api$contextIdentifie3, _api$contextIdentifie4;
|
|
313
|
-
var mode =
|
|
314
|
-
stats =
|
|
315
|
-
query =
|
|
316
|
-
sourceListItem =
|
|
336
|
+
var mode = _ref0.mode,
|
|
337
|
+
stats = _ref0.stats,
|
|
338
|
+
query = _ref0.query,
|
|
339
|
+
sourceListItem = _ref0.sourceListItem;
|
|
317
340
|
var schema = state.schema;
|
|
318
341
|
var pluginState = getMentionPluginState(state);
|
|
319
342
|
var mentionProvider = pluginState.mentionProvider;
|
|
320
|
-
var _item$
|
|
321
|
-
id = _item$
|
|
322
|
-
name = _item$
|
|
323
|
-
nickname = _item$
|
|
324
|
-
accessLevel = _item$
|
|
325
|
-
userType = _item$
|
|
326
|
-
isXProductUser = _item$
|
|
327
|
-
var
|
|
328
|
-
contextIdentifierProvider =
|
|
343
|
+
var _item$mention3 = item.mention,
|
|
344
|
+
id = _item$mention3.id,
|
|
345
|
+
name = _item$mention3.name,
|
|
346
|
+
nickname = _item$mention3.nickname,
|
|
347
|
+
accessLevel = _item$mention3.accessLevel,
|
|
348
|
+
userType = _item$mention3.userType,
|
|
349
|
+
isXProductUser = _item$mention3.isXProductUser;
|
|
350
|
+
var _ref1 = (_api$contextIdentifie3 = api === null || api === void 0 || (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {},
|
|
351
|
+
contextIdentifierProvider = _ref1.contextIdentifierProvider;
|
|
329
352
|
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
330
353
|
sessionId: sessionId
|
|
331
354
|
});
|
|
@@ -424,11 +447,11 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
424
447
|
isXProductUser: isXProductUser
|
|
425
448
|
}));
|
|
426
449
|
},
|
|
427
|
-
dismiss: function dismiss(
|
|
428
|
-
var editorState =
|
|
429
|
-
query =
|
|
430
|
-
stats =
|
|
431
|
-
wasItemInserted =
|
|
450
|
+
dismiss: function dismiss(_ref10) {
|
|
451
|
+
var editorState = _ref10.editorState,
|
|
452
|
+
query = _ref10.query,
|
|
453
|
+
stats = _ref10.stats,
|
|
454
|
+
wasItemInserted = _ref10.wasItemInserted;
|
|
432
455
|
firstQueryWithoutResults = null;
|
|
433
456
|
var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
|
|
434
457
|
if (!wasItemInserted) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.9",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^52.
|
|
32
|
+
"@atlaskit/adf-schema": "^52.15.0",
|
|
33
33
|
"@atlaskit/css": "^0.19.0",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^10.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-base": "^11.1.0",
|
|
36
36
|
"@atlaskit/editor-plugin-context-identifier": "^10.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-selection": "^10.1.0",
|
|
38
|
-
"@atlaskit/editor-plugin-type-ahead": "^10.
|
|
38
|
+
"@atlaskit/editor-plugin-type-ahead": "^10.3.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "^7.3.0",
|
|
40
40
|
"@atlaskit/icon": "^35.3.0",
|
|
41
41
|
"@atlaskit/insm": "^0.4.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/profilecard": "^25.7.0",
|
|
49
49
|
"@atlaskit/teams-app-config": "^1.12.0",
|
|
50
50
|
"@atlaskit/theme": "^25.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^84.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^84.3.0",
|
|
52
52
|
"@atlaskit/tokens": "^13.0.0",
|
|
53
53
|
"@atlaskit/user-picker": "^12.1.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"uuid": "^3.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/editor-common": "^114.
|
|
61
|
+
"@atlaskit/editor-common": "^114.50.0",
|
|
62
62
|
"react": "^18.2.0",
|
|
63
63
|
"react-dom": "^18.2.0",
|
|
64
64
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|