@atlaskit/editor-plugin-mentions 8.2.6 → 8.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/editor-commands/index.js +3 -0
- package/dist/cjs/mentionsPlugin.js +2 -1
- package/dist/cjs/nodeviews/profileCardRenderer.js +3 -0
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/type-ahead/index.js +36 -51
- package/dist/es2019/editor-commands/index.js +2 -0
- package/dist/es2019/mentionsPlugin.js +2 -0
- package/dist/es2019/nodeviews/profileCardRenderer.js +2 -0
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/type-ahead/index.js +23 -36
- package/dist/esm/editor-commands/index.js +2 -0
- package/dist/esm/mentionsPlugin.js +2 -0
- package/dist/esm/nodeviews/profileCardRenderer.js +2 -0
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/type-ahead/index.js +23 -36
- package/package.json +5 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 8.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 8.2.7
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`0a9692c1ee81f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0a9692c1ee81f) -
|
|
14
|
+
Cleanup minor refactor.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 8.2.6
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -10,6 +10,8 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
10
10
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
11
11
|
var _resource = require("@atlaskit/mention/resource");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
14
|
+
|
|
13
15
|
var createSingleMentionFragment = exports.createSingleMentionFragment = function createSingleMentionFragment(_ref) {
|
|
14
16
|
var mentionInsertDisplayName = _ref.mentionInsertDisplayName,
|
|
15
17
|
mentionProvider = _ref.mentionProvider,
|
|
@@ -42,6 +44,7 @@ var createSingleMentionFragment = exports.createSingleMentionFragment = function
|
|
|
42
44
|
id: id,
|
|
43
45
|
accessLevel: accessLevel,
|
|
44
46
|
userType: userType === 'DEFAULT' ? null : userType,
|
|
47
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
45
48
|
localId: localId !== null && localId !== void 0 ? localId : (0, _uuid.default)()
|
|
46
49
|
}, null, (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
47
50
|
var space = schema.text(' ', (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
@@ -27,7 +27,7 @@ var _SecondaryToolbarComponent = require("./ui/SecondaryToolbarComponent");
|
|
|
27
27
|
var _typeAhead = require("./ui/type-ahead");
|
|
28
28
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
29
29
|
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; }
|
|
30
|
-
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; }
|
|
30
|
+
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
|
|
31
31
|
var processName = function processName(name, intl) {
|
|
32
32
|
var unknownLabel = intl.formatMessage(_messages.mentionMessages.unknownLabel);
|
|
33
33
|
if (name.status === _types.MentionNameStatus.OK) {
|
|
@@ -83,6 +83,7 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
83
83
|
var _options$sanitizePriv, _options$insertDispla;
|
|
84
84
|
var options = _ref3.config,
|
|
85
85
|
api = _ref3.api;
|
|
86
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
86
87
|
var sessionId = (0, _uuid.default)();
|
|
87
88
|
var previousMediaProvider;
|
|
88
89
|
var fireEvent = function fireEvent(payload, channel) {
|
|
@@ -10,6 +10,8 @@ var _bindEventListener = require("bind-event-listener");
|
|
|
10
10
|
var _v = _interopRequireDefault(require("uuid/v4"));
|
|
11
11
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
12
|
var _ProfileCardComponent = require("../ui/ProfileCardComponent");
|
|
13
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
14
|
+
|
|
13
15
|
var profileCardRenderer = exports.profileCardRenderer = function profileCardRenderer(_ref) {
|
|
14
16
|
var dom = _ref.dom,
|
|
15
17
|
options = _ref.options,
|
|
@@ -17,6 +19,7 @@ var profileCardRenderer = exports.profileCardRenderer = function profileCardRend
|
|
|
17
19
|
node = _ref.node,
|
|
18
20
|
api = _ref.api;
|
|
19
21
|
var renderingProfileCard = false;
|
|
22
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
20
23
|
var key = (0, _v.default)();
|
|
21
24
|
var cleanupSelection;
|
|
22
25
|
var removeProfileCard = function removeProfileCard() {
|
|
@@ -25,7 +25,7 @@ var ACTIONS = exports.ACTIONS = {
|
|
|
25
25
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
26
26
|
};
|
|
27
27
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
28
|
-
var PACKAGE_VERSION = "8.2.
|
|
28
|
+
var PACKAGE_VERSION = "8.2.7";
|
|
29
29
|
var setProvider = function setProvider(provider) {
|
|
30
30
|
return function (state, dispatch) {
|
|
31
31
|
if (dispatch) {
|
|
@@ -13,24 +13,23 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
15
15
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
16
|
-
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
16
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
18
|
-
var
|
|
17
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
19
18
|
var _item = require("@atlaskit/mention/item");
|
|
20
19
|
var _resource = require("@atlaskit/mention/resource");
|
|
21
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
22
21
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
22
|
var _editorCommands = require("../../editor-commands");
|
|
24
|
-
var
|
|
23
|
+
var _utils2 = require("../../pm-plugins/utils");
|
|
25
24
|
var _InviteItem = _interopRequireWildcard(require("../InviteItem"));
|
|
26
25
|
var _analytics = require("./analytics");
|
|
27
|
-
var
|
|
26
|
+
var _utils3 = require("./utils");
|
|
28
27
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
29
28
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
30
29
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
31
30
|
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; }
|
|
32
31
|
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; }
|
|
33
|
-
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; }
|
|
32
|
+
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
|
|
34
33
|
var createInviteItem = function createInviteItem(_ref) {
|
|
35
34
|
var mentionProvider = _ref.mentionProvider,
|
|
36
35
|
onInviteItemMount = _ref.onInviteItemMount;
|
|
@@ -62,7 +61,7 @@ var withInviteItem = function withInviteItem(_ref3) {
|
|
|
62
61
|
mentionProvider: mentionProvider,
|
|
63
62
|
onInviteItemMount: onInviteItemMount
|
|
64
63
|
});
|
|
65
|
-
var keepInviteItem = (0,
|
|
64
|
+
var keepInviteItem = (0, _utils3.shouldKeepInviteItem)(currentQuery, firstQueryWithoutResults);
|
|
66
65
|
if (mentionItems.length === 0) {
|
|
67
66
|
return keepInviteItem ? [inviteItem] : [];
|
|
68
67
|
}
|
|
@@ -123,7 +122,7 @@ var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAh
|
|
|
123
122
|
var userOrTeamIds = null;
|
|
124
123
|
var teams = null;
|
|
125
124
|
var xProductMentionsLength = 0;
|
|
126
|
-
if (!(0,
|
|
125
|
+
if (!(0, _utils3.isTeamStats)(stats)) {
|
|
127
126
|
// is from primary mention endpoint which could be just user mentions or user/team mentions
|
|
128
127
|
duration = stats && stats.duration;
|
|
129
128
|
teams = null;
|
|
@@ -138,7 +137,7 @@ var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAh
|
|
|
138
137
|
duration = stats && stats.teamMentionDuration;
|
|
139
138
|
userOrTeamIds = null;
|
|
140
139
|
teams = mentions.map(function (mention) {
|
|
141
|
-
return (0,
|
|
140
|
+
return (0, _utils3.isTeamType)(mention.userType) ? {
|
|
142
141
|
teamId: mention.id,
|
|
143
142
|
// Ignored via go/ees005
|
|
144
143
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -197,6 +196,7 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
197
196
|
id: member.id,
|
|
198
197
|
accessLevel: accessLevel,
|
|
199
198
|
userType: 'DEFAULT',
|
|
199
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
200
200
|
localId: (0, _uuid.default)()
|
|
201
201
|
});
|
|
202
202
|
inlineNodes.push(userMentionNode);
|
|
@@ -215,6 +215,7 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
215
215
|
HighlightComponent = _ref6.HighlightComponent,
|
|
216
216
|
api = _ref6.api,
|
|
217
217
|
handleMentionsChanged = _ref6.handleMentionsChanged;
|
|
218
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
218
219
|
var sessionId = (0, _uuid.default)();
|
|
219
220
|
var firstQueryWithoutResults = null;
|
|
220
221
|
var subscriptionKeys = new Set();
|
|
@@ -235,7 +236,7 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
235
236
|
var _api$contextIdentifie, _api$contextIdentifie2;
|
|
236
237
|
var query = _ref7.query,
|
|
237
238
|
editorState = _ref7.editorState;
|
|
238
|
-
var pluginState = (0,
|
|
239
|
+
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
239
240
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
240
241
|
return Promise.resolve([]);
|
|
241
242
|
}
|
|
@@ -243,6 +244,7 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
243
244
|
var _ref8 = (_api$contextIdentifie = api === null || api === void 0 || (_api$contextIdentifie2 = api.contextIdentifier) === null || _api$contextIdentifie2 === void 0 ? void 0 : _api$contextIdentifie2.sharedState.currentState()) !== null && _api$contextIdentifie !== void 0 ? _api$contextIdentifie : {},
|
|
244
245
|
contextIdentifierProvider = _ref8.contextIdentifierProvider;
|
|
245
246
|
return new Promise(function (resolve, reject) {
|
|
247
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
246
248
|
var key = "loadingMentionsForTypeAhead_".concat((0, _uuid.default)());
|
|
247
249
|
var mentionsSubscribeCallback = function mentionsSubscribeCallback(mentions) {
|
|
248
250
|
var resultQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -300,7 +302,7 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
300
302
|
query = _ref9.query,
|
|
301
303
|
sourceListItem = _ref9.sourceListItem;
|
|
302
304
|
var schema = state.schema;
|
|
303
|
-
var pluginState = (0,
|
|
305
|
+
var pluginState = (0, _utils2.getMentionPluginState)(state);
|
|
304
306
|
var mentionProvider = pluginState.mentionProvider;
|
|
305
307
|
var _item$mention = item.mention,
|
|
306
308
|
id = _item$mention.id,
|
|
@@ -309,20 +311,18 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
309
311
|
accessLevel = _item$mention.accessLevel,
|
|
310
312
|
userType = _item$mention.userType,
|
|
311
313
|
isXProductUser = _item$mention.isXProductUser;
|
|
312
|
-
var trimmedNickname = nickname && nickname.startsWith('@') ? nickname.slice(1) : nickname;
|
|
313
|
-
var renderName = mentionInsertDisplayName || !trimmedNickname ? name : trimmedNickname;
|
|
314
314
|
var _ref0 = (_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 : {},
|
|
315
315
|
contextIdentifierProvider = _ref0.contextIdentifierProvider;
|
|
316
316
|
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
317
317
|
sessionId: sessionId
|
|
318
318
|
});
|
|
319
|
-
if (mentionProvider && !(0,
|
|
319
|
+
if (mentionProvider && !(0, _utils3.isInviteItem)(item.mention)) {
|
|
320
320
|
mentionProvider.recordMentionSelection(item.mention, mentionContext);
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
// use same timer as StatsModifier
|
|
324
324
|
var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
|
|
325
|
-
if (mentionProvider && mentionProvider.shouldEnableInvite && (0,
|
|
325
|
+
if (mentionProvider && mentionProvider.shouldEnableInvite && (0, _utils3.isInviteItem)(item.mention)) {
|
|
326
326
|
// Don't fire event and the callback with selection by space press
|
|
327
327
|
if (mode !== 'space') {
|
|
328
328
|
fireEvent((0, _analytics.buildTypeAheadInviteItemClickedPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, contextIdentifierProvider, mentionProvider.userRole));
|
|
@@ -333,14 +333,16 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
333
333
|
return state.tr;
|
|
334
334
|
}
|
|
335
335
|
var taskListId, taskItemId;
|
|
336
|
-
var taskList = (0,
|
|
336
|
+
var taskList = (0, _utils.findParentNodeOfType)(state.schema.nodes.taskList)(state.selection);
|
|
337
337
|
if (taskList) {
|
|
338
338
|
taskListId = taskList.node.attrs.localId;
|
|
339
|
-
var taskItem = (0,
|
|
339
|
+
var taskItem = (0, _utils.findParentNodeOfType)(state.schema.nodes.taskItem)(state.selection);
|
|
340
340
|
if (taskItem) {
|
|
341
341
|
taskItemId = taskItem.node.attrs.localId;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
+
|
|
345
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
344
346
|
var mentionLocalId = (0, _uuid.default)();
|
|
345
347
|
if (handleMentionsChanged) {
|
|
346
348
|
if (taskItemId) {
|
|
@@ -363,48 +365,29 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
363
365
|
fireEvent((0, _analytics.buildTypeAheadInsertedPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, item.mention, mentionLocalId, sourceListItem.map(function (x) {
|
|
364
366
|
return x.mention;
|
|
365
367
|
}), query, contextIdentifierProvider, taskListId, taskItemId));
|
|
368
|
+
|
|
369
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
366
370
|
sessionId = (0, _uuid.default)();
|
|
367
|
-
if (mentionProvider && (0,
|
|
371
|
+
if (mentionProvider && (0, _utils3.isTeamType)(userType)) {
|
|
368
372
|
return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
|
|
369
373
|
}
|
|
370
374
|
if (isXProductUser && mentionProvider && mentionProvider.inviteXProductUser) {
|
|
371
375
|
mentionProvider.inviteXProductUser(id, name);
|
|
372
376
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
sanitizePrivateContent: sanitizePrivateContent
|
|
381
|
-
})({
|
|
382
|
-
name: name,
|
|
383
|
-
id: id,
|
|
384
|
-
userType: userType,
|
|
385
|
-
nickname: nickname,
|
|
386
|
-
localId: mentionLocalId,
|
|
387
|
-
accessLevel: accessLevel,
|
|
388
|
-
isXProductUser: isXProductUser
|
|
389
|
-
}));
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// Don't insert into document if document data is sanitized.
|
|
393
|
-
var text = sanitizePrivateContent ? '' : "@".concat(renderName);
|
|
394
|
-
if (sanitizePrivateContent && (0, _resource.isResolvingMentionProvider)(mentionProvider)) {
|
|
395
|
-
// Cache (locally) for later rendering
|
|
396
|
-
mentionProvider.cacheMentionName(id, renderName);
|
|
397
|
-
}
|
|
398
|
-
var annotationMarksForPos = (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? (0, _utils.getAnnotationMarksForPos)(state.tr.selection.$head) : undefined;
|
|
399
|
-
var mentionNode = schema.nodes.mention.createChecked({
|
|
400
|
-
text: text,
|
|
377
|
+
return insert((0, _editorCommands.createSingleMentionFragment)({
|
|
378
|
+
mentionProvider: mentionProvider,
|
|
379
|
+
mentionInsertDisplayName: mentionInsertDisplayName,
|
|
380
|
+
tr: state.tr,
|
|
381
|
+
sanitizePrivateContent: sanitizePrivateContent
|
|
382
|
+
})({
|
|
383
|
+
name: name,
|
|
401
384
|
id: id,
|
|
385
|
+
userType: userType,
|
|
386
|
+
nickname: nickname,
|
|
387
|
+
localId: mentionLocalId,
|
|
402
388
|
accessLevel: accessLevel,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}, null, (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
406
|
-
var space = schema.text(' ', (0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
407
|
-
return insert(_model.Fragment.from([mentionNode, space]));
|
|
389
|
+
isXProductUser: isXProductUser
|
|
390
|
+
}));
|
|
408
391
|
},
|
|
409
392
|
dismiss: function dismiss(_ref1) {
|
|
410
393
|
var editorState = _ref1.editorState,
|
|
@@ -416,7 +399,7 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
416
399
|
if (!wasItemInserted) {
|
|
417
400
|
fireEvent((0, _analytics.buildTypeAheadCancelPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, query || ''), 'fabric-elements');
|
|
418
401
|
}
|
|
419
|
-
var pluginState = (0,
|
|
402
|
+
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
420
403
|
if (pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider) {
|
|
421
404
|
var mentionProvider = pluginState.mentionProvider;
|
|
422
405
|
var _iterator = _createForOfIteratorHelper(subscriptionKeys),
|
|
@@ -433,6 +416,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
433
416
|
}
|
|
434
417
|
}
|
|
435
418
|
subscriptionKeys.clear();
|
|
419
|
+
|
|
420
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
436
421
|
sessionId = (0, _uuid.default)();
|
|
437
422
|
}
|
|
438
423
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
1
2
|
import uuid from 'uuid';
|
|
2
3
|
import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils';
|
|
3
4
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -36,6 +37,7 @@ export const createSingleMentionFragment = ({
|
|
|
36
37
|
id,
|
|
37
38
|
accessLevel,
|
|
38
39
|
userType: userType === 'DEFAULT' ? null : userType,
|
|
40
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
39
41
|
localId: localId !== null && localId !== void 0 ? localId : uuid()
|
|
40
42
|
}, null, fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
41
43
|
const space = schema.text(' ', fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useMemo } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
4
|
import uuid from 'uuid';
|
|
4
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
import { toolbarInsertBlockMessages as messages, mentionMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -80,6 +81,7 @@ const mentionsPlugin = ({
|
|
|
80
81
|
api
|
|
81
82
|
}) => {
|
|
82
83
|
var _options$sanitizePriv, _options$insertDispla;
|
|
84
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
83
85
|
const sessionId = uuid();
|
|
84
86
|
let previousMediaProvider;
|
|
85
87
|
const fireEvent = (payload, channel) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
4
|
import uuid from 'uuid/v4';
|
|
4
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import { ProfileCardComponent } from '../ui/ProfileCardComponent';
|
|
@@ -11,6 +12,7 @@ export const profileCardRenderer = ({
|
|
|
11
12
|
api
|
|
12
13
|
}) => {
|
|
13
14
|
let renderingProfileCard = false;
|
|
15
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
14
16
|
const key = uuid();
|
|
15
17
|
let cleanupSelection;
|
|
16
18
|
const removeProfileCard = () => {
|
|
@@ -14,7 +14,7 @@ export const ACTIONS = {
|
|
|
14
14
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
15
15
|
};
|
|
16
16
|
const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
17
|
-
const PACKAGE_VERSION = "8.2.
|
|
17
|
+
const PACKAGE_VERSION = "8.2.7";
|
|
18
18
|
const setProvider = provider => (state, dispatch) => {
|
|
19
19
|
if (dispatch) {
|
|
20
20
|
dispatch(state.tr.setMeta(mentionPluginKey, {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
2
4
|
import uuid from 'uuid';
|
|
3
5
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
4
|
-
import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils';
|
|
5
6
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
6
7
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
import { MENTION_ITEM_HEIGHT, MentionItem } from '@atlaskit/mention/item';
|
|
@@ -172,6 +173,7 @@ const buildNodesForTeamMention = (schema, selectedMention, mentionProvider, sani
|
|
|
172
173
|
id: member.id,
|
|
173
174
|
accessLevel,
|
|
174
175
|
userType: 'DEFAULT',
|
|
176
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
175
177
|
localId: uuid()
|
|
176
178
|
});
|
|
177
179
|
inlineNodes.push(userMentionNode);
|
|
@@ -191,6 +193,7 @@ export const createTypeAheadConfig = ({
|
|
|
191
193
|
api,
|
|
192
194
|
handleMentionsChanged
|
|
193
195
|
}) => {
|
|
196
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
194
197
|
let sessionId = uuid();
|
|
195
198
|
let firstQueryWithoutResults = null;
|
|
196
199
|
const subscriptionKeys = new Set();
|
|
@@ -223,6 +226,7 @@ export const createTypeAheadConfig = ({
|
|
|
223
226
|
contextIdentifierProvider
|
|
224
227
|
} = (_api$contextIdentifie = api === null || api === void 0 ? void 0 : (_api$contextIdentifie2 = api.contextIdentifier) === null || _api$contextIdentifie2 === void 0 ? void 0 : _api$contextIdentifie2.sharedState.currentState()) !== null && _api$contextIdentifie !== void 0 ? _api$contextIdentifie : {};
|
|
225
228
|
return new Promise((resolve, reject) => {
|
|
229
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
226
230
|
const key = `loadingMentionsForTypeAhead_${uuid()}`;
|
|
227
231
|
const mentionsSubscribeCallback = (mentions, resultQuery = '', stats) => {
|
|
228
232
|
if (query !== resultQuery) {
|
|
@@ -292,8 +296,6 @@ export const createTypeAheadConfig = ({
|
|
|
292
296
|
userType,
|
|
293
297
|
isXProductUser
|
|
294
298
|
} = item.mention;
|
|
295
|
-
const trimmedNickname = nickname && nickname.startsWith('@') ? nickname.slice(1) : nickname;
|
|
296
|
-
const renderName = mentionInsertDisplayName || !trimmedNickname ? name : trimmedNickname;
|
|
297
299
|
const {
|
|
298
300
|
contextIdentifierProvider
|
|
299
301
|
} = (_api$contextIdentifie3 = api === null || api === void 0 ? void 0 : (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {};
|
|
@@ -326,6 +328,8 @@ export const createTypeAheadConfig = ({
|
|
|
326
328
|
taskItemId = taskItem.node.attrs.localId;
|
|
327
329
|
}
|
|
328
330
|
}
|
|
331
|
+
|
|
332
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
329
333
|
const mentionLocalId = uuid();
|
|
330
334
|
if (handleMentionsChanged) {
|
|
331
335
|
if (taskItemId) {
|
|
@@ -346,6 +350,8 @@ export const createTypeAheadConfig = ({
|
|
|
346
350
|
}
|
|
347
351
|
}
|
|
348
352
|
fireEvent(buildTypeAheadInsertedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, item.mention, mentionLocalId, sourceListItem.map(x => x.mention), query, contextIdentifierProvider, taskListId, taskItemId));
|
|
353
|
+
|
|
354
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
349
355
|
sessionId = uuid();
|
|
350
356
|
if (mentionProvider && isTeamType(userType)) {
|
|
351
357
|
return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
|
|
@@ -353,41 +359,20 @@ export const createTypeAheadConfig = ({
|
|
|
353
359
|
if (isXProductUser && mentionProvider && mentionProvider.inviteXProductUser) {
|
|
354
360
|
mentionProvider.inviteXProductUser(id, name);
|
|
355
361
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
sanitizePrivateContent
|
|
364
|
-
})({
|
|
365
|
-
name,
|
|
366
|
-
id,
|
|
367
|
-
userType,
|
|
368
|
-
nickname,
|
|
369
|
-
localId: mentionLocalId,
|
|
370
|
-
accessLevel,
|
|
371
|
-
isXProductUser
|
|
372
|
-
}));
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// Don't insert into document if document data is sanitized.
|
|
376
|
-
const text = sanitizePrivateContent ? '' : `@${renderName}`;
|
|
377
|
-
if (sanitizePrivateContent && isResolvingMentionProvider(mentionProvider)) {
|
|
378
|
-
// Cache (locally) for later rendering
|
|
379
|
-
mentionProvider.cacheMentionName(id, renderName);
|
|
380
|
-
}
|
|
381
|
-
const annotationMarksForPos = fg('editor_inline_comments_paste_insert_nodes') ? getAnnotationMarksForPos(state.tr.selection.$head) : undefined;
|
|
382
|
-
const mentionNode = schema.nodes.mention.createChecked({
|
|
383
|
-
text,
|
|
362
|
+
return insert(createSingleMentionFragment({
|
|
363
|
+
mentionProvider,
|
|
364
|
+
mentionInsertDisplayName,
|
|
365
|
+
tr: state.tr,
|
|
366
|
+
sanitizePrivateContent
|
|
367
|
+
})({
|
|
368
|
+
name,
|
|
384
369
|
id,
|
|
370
|
+
userType,
|
|
371
|
+
nickname,
|
|
372
|
+
localId: mentionLocalId,
|
|
385
373
|
accessLevel,
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}, null, fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
389
|
-
const space = schema.text(' ', fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
390
|
-
return insert(Fragment.from([mentionNode, space]));
|
|
374
|
+
isXProductUser
|
|
375
|
+
}));
|
|
391
376
|
},
|
|
392
377
|
dismiss({
|
|
393
378
|
editorState,
|
|
@@ -408,6 +393,8 @@ export const createTypeAheadConfig = ({
|
|
|
408
393
|
}
|
|
409
394
|
}
|
|
410
395
|
subscriptionKeys.clear();
|
|
396
|
+
|
|
397
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
411
398
|
sessionId = uuid();
|
|
412
399
|
}
|
|
413
400
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
1
2
|
import uuid from 'uuid';
|
|
2
3
|
import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils';
|
|
3
4
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -35,6 +36,7 @@ export var createSingleMentionFragment = function createSingleMentionFragment(_r
|
|
|
35
36
|
id: id,
|
|
36
37
|
accessLevel: accessLevel,
|
|
37
38
|
userType: userType === 'DEFAULT' ? null : userType,
|
|
39
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
38
40
|
localId: localId !== null && localId !== void 0 ? localId : uuid()
|
|
39
41
|
}, null, fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
40
42
|
var space = schema.text(' ', fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
@@ -5,6 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import React, { useEffect, useMemo } from 'react';
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
8
9
|
import uuid from 'uuid';
|
|
9
10
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
10
11
|
import { toolbarInsertBlockMessages as messages, mentionMessages } from '@atlaskit/editor-common/messages';
|
|
@@ -74,6 +75,7 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
74
75
|
var _options$sanitizePriv, _options$insertDispla;
|
|
75
76
|
var options = _ref3.config,
|
|
76
77
|
api = _ref3.api;
|
|
78
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
77
79
|
var sessionId = uuid();
|
|
78
80
|
var previousMediaProvider;
|
|
79
81
|
var fireEvent = function fireEvent(payload, channel) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { bind } from 'bind-event-listener';
|
|
3
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
3
4
|
import uuid from 'uuid/v4';
|
|
4
5
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
6
|
import { ProfileCardComponent } from '../ui/ProfileCardComponent';
|
|
@@ -10,6 +11,7 @@ export var profileCardRenderer = function profileCardRenderer(_ref) {
|
|
|
10
11
|
node = _ref.node,
|
|
11
12
|
api = _ref.api;
|
|
12
13
|
var renderingProfileCard = false;
|
|
14
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
13
15
|
var key = uuid();
|
|
14
16
|
var cleanupSelection;
|
|
15
17
|
var removeProfileCard = function removeProfileCard() {
|
|
@@ -17,7 +17,7 @@ export var ACTIONS = {
|
|
|
17
17
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
18
18
|
};
|
|
19
19
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
20
|
-
var PACKAGE_VERSION = "8.2.
|
|
20
|
+
var PACKAGE_VERSION = "8.2.7";
|
|
21
21
|
var setProvider = function setProvider(provider) {
|
|
22
22
|
return function (state, dispatch) {
|
|
23
23
|
if (dispatch) {
|
|
@@ -6,9 +6,10 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
8
|
import React from 'react';
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
9
11
|
import uuid from 'uuid';
|
|
10
12
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
11
|
-
import { getAnnotationMarksForPos } from '@atlaskit/editor-common/utils';
|
|
12
13
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
13
14
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
14
15
|
import { MENTION_ITEM_HEIGHT, MentionItem } from '@atlaskit/mention/item';
|
|
@@ -186,6 +187,7 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
186
187
|
id: member.id,
|
|
187
188
|
accessLevel: accessLevel,
|
|
188
189
|
userType: 'DEFAULT',
|
|
190
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
189
191
|
localId: uuid()
|
|
190
192
|
});
|
|
191
193
|
inlineNodes.push(userMentionNode);
|
|
@@ -204,6 +206,7 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
204
206
|
HighlightComponent = _ref6.HighlightComponent,
|
|
205
207
|
api = _ref6.api,
|
|
206
208
|
handleMentionsChanged = _ref6.handleMentionsChanged;
|
|
209
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
207
210
|
var sessionId = uuid();
|
|
208
211
|
var firstQueryWithoutResults = null;
|
|
209
212
|
var subscriptionKeys = new Set();
|
|
@@ -232,6 +235,7 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
232
235
|
var _ref8 = (_api$contextIdentifie = api === null || api === void 0 || (_api$contextIdentifie2 = api.contextIdentifier) === null || _api$contextIdentifie2 === void 0 ? void 0 : _api$contextIdentifie2.sharedState.currentState()) !== null && _api$contextIdentifie !== void 0 ? _api$contextIdentifie : {},
|
|
233
236
|
contextIdentifierProvider = _ref8.contextIdentifierProvider;
|
|
234
237
|
return new Promise(function (resolve, reject) {
|
|
238
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
235
239
|
var key = "loadingMentionsForTypeAhead_".concat(uuid());
|
|
236
240
|
var mentionsSubscribeCallback = function mentionsSubscribeCallback(mentions) {
|
|
237
241
|
var resultQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
@@ -298,8 +302,6 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
298
302
|
accessLevel = _item$mention.accessLevel,
|
|
299
303
|
userType = _item$mention.userType,
|
|
300
304
|
isXProductUser = _item$mention.isXProductUser;
|
|
301
|
-
var trimmedNickname = nickname && nickname.startsWith('@') ? nickname.slice(1) : nickname;
|
|
302
|
-
var renderName = mentionInsertDisplayName || !trimmedNickname ? name : trimmedNickname;
|
|
303
305
|
var _ref0 = (_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 : {},
|
|
304
306
|
contextIdentifierProvider = _ref0.contextIdentifierProvider;
|
|
305
307
|
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
@@ -330,6 +332,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
330
332
|
taskItemId = taskItem.node.attrs.localId;
|
|
331
333
|
}
|
|
332
334
|
}
|
|
335
|
+
|
|
336
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
333
337
|
var mentionLocalId = uuid();
|
|
334
338
|
if (handleMentionsChanged) {
|
|
335
339
|
if (taskItemId) {
|
|
@@ -352,6 +356,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
352
356
|
fireEvent(buildTypeAheadInsertedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, item.mention, mentionLocalId, sourceListItem.map(function (x) {
|
|
353
357
|
return x.mention;
|
|
354
358
|
}), query, contextIdentifierProvider, taskListId, taskItemId));
|
|
359
|
+
|
|
360
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
355
361
|
sessionId = uuid();
|
|
356
362
|
if (mentionProvider && isTeamType(userType)) {
|
|
357
363
|
return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
|
|
@@ -359,41 +365,20 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
359
365
|
if (isXProductUser && mentionProvider && mentionProvider.inviteXProductUser) {
|
|
360
366
|
mentionProvider.inviteXProductUser(id, name);
|
|
361
367
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
sanitizePrivateContent: sanitizePrivateContent
|
|
370
|
-
})({
|
|
371
|
-
name: name,
|
|
372
|
-
id: id,
|
|
373
|
-
userType: userType,
|
|
374
|
-
nickname: nickname,
|
|
375
|
-
localId: mentionLocalId,
|
|
376
|
-
accessLevel: accessLevel,
|
|
377
|
-
isXProductUser: isXProductUser
|
|
378
|
-
}));
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
// Don't insert into document if document data is sanitized.
|
|
382
|
-
var text = sanitizePrivateContent ? '' : "@".concat(renderName);
|
|
383
|
-
if (sanitizePrivateContent && isResolvingMentionProvider(mentionProvider)) {
|
|
384
|
-
// Cache (locally) for later rendering
|
|
385
|
-
mentionProvider.cacheMentionName(id, renderName);
|
|
386
|
-
}
|
|
387
|
-
var annotationMarksForPos = fg('editor_inline_comments_paste_insert_nodes') ? getAnnotationMarksForPos(state.tr.selection.$head) : undefined;
|
|
388
|
-
var mentionNode = schema.nodes.mention.createChecked({
|
|
389
|
-
text: text,
|
|
368
|
+
return insert(createSingleMentionFragment({
|
|
369
|
+
mentionProvider: mentionProvider,
|
|
370
|
+
mentionInsertDisplayName: mentionInsertDisplayName,
|
|
371
|
+
tr: state.tr,
|
|
372
|
+
sanitizePrivateContent: sanitizePrivateContent
|
|
373
|
+
})({
|
|
374
|
+
name: name,
|
|
390
375
|
id: id,
|
|
376
|
+
userType: userType,
|
|
377
|
+
nickname: nickname,
|
|
378
|
+
localId: mentionLocalId,
|
|
391
379
|
accessLevel: accessLevel,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}, null, fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
395
|
-
var space = schema.text(' ', fg('editor_inline_comments_paste_insert_nodes') ? annotationMarksForPos : undefined);
|
|
396
|
-
return insert(Fragment.from([mentionNode, space]));
|
|
380
|
+
isXProductUser: isXProductUser
|
|
381
|
+
}));
|
|
397
382
|
},
|
|
398
383
|
dismiss: function dismiss(_ref1) {
|
|
399
384
|
var editorState = _ref1.editorState,
|
|
@@ -422,6 +407,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
422
407
|
}
|
|
423
408
|
}
|
|
424
409
|
subscriptionKeys.clear();
|
|
410
|
+
|
|
411
|
+
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
425
412
|
sessionId = uuid();
|
|
426
413
|
}
|
|
427
414
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.8",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@atlaskit/icon": "^28.5.0",
|
|
41
41
|
"@atlaskit/insm": "^0.2.0",
|
|
42
42
|
"@atlaskit/link": "^3.2.0",
|
|
43
|
-
"@atlaskit/mention": "^24.
|
|
43
|
+
"@atlaskit/mention": "^24.4.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/popper": "^7.1.0",
|
|
46
46
|
"@atlaskit/portal": "^5.1.0",
|
|
47
47
|
"@atlaskit/profilecard": "^24.20.0",
|
|
48
48
|
"@atlaskit/theme": "^21.0.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
50
|
-
"@atlaskit/tokens": "^
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^13.32.0",
|
|
50
|
+
"@atlaskit/tokens": "^8.0.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@compiled/react": "^0.18.6",
|
|
53
53
|
"bind-event-listener": "^3.0.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"uuid": "^3.1.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@atlaskit/editor-common": "^110.
|
|
58
|
+
"@atlaskit/editor-common": "^110.24.0",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-dom": "^18.2.0",
|
|
61
61
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -113,9 +113,6 @@
|
|
|
113
113
|
"platform_editor_mention_provider_via_plugin_config": {
|
|
114
114
|
"type": "boolean"
|
|
115
115
|
},
|
|
116
|
-
"platform_mention_insert_mention_refactor": {
|
|
117
|
-
"type": "boolean"
|
|
118
|
-
},
|
|
119
116
|
"platform_editor_adf_with_localid": {
|
|
120
117
|
"type": "boolean"
|
|
121
118
|
},
|