@atlaskit/editor-plugin-mentions 17.0.1 → 17.1.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 +11 -0
- package/dist/cjs/mentionsPlugin.js +1 -0
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/PopperWrapper.js +14 -9
- package/dist/cjs/ui/ProfileCardComponent.js +36 -11
- package/dist/cjs/ui/type-ahead/MentionItemWithProfileCard.js +106 -0
- package/dist/cjs/ui/type-ahead/index.js +80 -71
- package/dist/cjs/ui/type-ahead/utils.js +7 -1
- package/dist/cjs/ui/useFocusTrap.js +5 -3
- package/dist/es2019/mentionsPlugin.js +1 -0
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/PopperWrapper.js +10 -8
- package/dist/es2019/ui/ProfileCardComponent.js +35 -10
- package/dist/es2019/ui/type-ahead/MentionItemWithProfileCard.js +91 -0
- package/dist/es2019/ui/type-ahead/index.js +22 -8
- package/dist/es2019/ui/type-ahead/utils.js +2 -0
- package/dist/es2019/ui/useFocusTrap.js +4 -3
- package/dist/esm/mentionsPlugin.js +1 -0
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/PopperWrapper.js +13 -8
- package/dist/esm/ui/ProfileCardComponent.js +36 -11
- package/dist/esm/ui/type-ahead/MentionItemWithProfileCard.js +98 -0
- package/dist/esm/ui/type-ahead/index.js +78 -69
- package/dist/esm/ui/type-ahead/utils.js +6 -0
- package/dist/esm/ui/useFocusTrap.js +5 -3
- package/dist/types/ui/PopperWrapper.d.ts +15 -2
- package/dist/types/ui/ProfileCardComponent.d.ts +6 -1
- package/dist/types/ui/type-ahead/MentionItemWithProfileCard.d.ts +15 -0
- package/dist/types/ui/type-ahead/index.d.ts +3 -1
- package/dist/types/ui/type-ahead/utils.d.ts +2 -0
- package/dist/types/ui/useFocusTrap.d.ts +2 -1
- package/package.json +8 -5
|
@@ -27,13 +27,8 @@ import { getMentionPluginState } from '../../pm-plugins/utils';
|
|
|
27
27
|
import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
28
28
|
import InviteItemWithEmailDomain from '../InviteItem/InviteItemWithEmailDomain';
|
|
29
29
|
import { buildTypeAheadCancelPayload, buildTypeAheadInsertedPayload, buildTypeAheadInviteItemClickedPayload, buildTypeAheadInviteItemViewedPayload, buildTypeAheadRenderedPayload } from './analytics';
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
return userType === 'APP' || userType === 'AGENT';
|
|
33
|
-
};
|
|
34
|
-
var isAgentMention = function isAgentMention(mention) {
|
|
35
|
-
return isAgentUserType(mention.userType) || mention.appType === 'agent';
|
|
36
|
-
};
|
|
30
|
+
import { MentionItemWithProfileCard } from './MentionItemWithProfileCard';
|
|
31
|
+
import { isAgentMention, isInviteItem, isTeamStats, isTeamType, shouldKeepInviteItem } from './utils';
|
|
37
32
|
var isAgentTypeAheadItem = function isAgentTypeAheadItem(item) {
|
|
38
33
|
return item.mention ? isAgentMention(item.mention) : false;
|
|
39
34
|
};
|
|
@@ -100,16 +95,24 @@ var withInviteItem = function withInviteItem(_ref3) {
|
|
|
100
95
|
inviteItem]);
|
|
101
96
|
};
|
|
102
97
|
};
|
|
103
|
-
var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(
|
|
98
|
+
var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(_ref4) {
|
|
99
|
+
var useRefreshedItemHeight = _ref4.useRefreshedItemHeight,
|
|
100
|
+
profilecardProvider = _ref4.profilecardProvider;
|
|
104
101
|
return function (mention) {
|
|
105
102
|
var itemHeight = useRefreshedItemHeight ? MENTION_ITEM_HEIGHT_REFRESHED : MENTION_ITEM_HEIGHT;
|
|
106
103
|
return {
|
|
107
104
|
title: mention.id,
|
|
108
|
-
render: function render(
|
|
109
|
-
var isSelected =
|
|
110
|
-
onClick =
|
|
111
|
-
onHover =
|
|
112
|
-
return /*#__PURE__*/React.createElement(
|
|
105
|
+
render: function render(_ref5) {
|
|
106
|
+
var isSelected = _ref5.isSelected,
|
|
107
|
+
onClick = _ref5.onClick,
|
|
108
|
+
onHover = _ref5.onHover;
|
|
109
|
+
return expVal('platform_editor_agent_mentions', 'isEnabled', false) && fg('platform_editor_mention_typeahead_profilecard') ? /*#__PURE__*/React.createElement(MentionItemWithProfileCard, {
|
|
110
|
+
mention: mention,
|
|
111
|
+
selected: isSelected,
|
|
112
|
+
onSelection: onClick,
|
|
113
|
+
height: itemHeight,
|
|
114
|
+
profilecardProvider: profilecardProvider
|
|
115
|
+
}) : /*#__PURE__*/React.createElement(MentionItem, {
|
|
113
116
|
mention: mention,
|
|
114
117
|
selected: isSelected,
|
|
115
118
|
onMouseEnter: onHover,
|
|
@@ -125,7 +128,9 @@ var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(useRefreshe
|
|
|
125
128
|
};
|
|
126
129
|
};
|
|
127
130
|
export var mentionToTypeaheadItem = function mentionToTypeaheadItem(mention) {
|
|
128
|
-
return makeMentionToTypeaheadItem(
|
|
131
|
+
return makeMentionToTypeaheadItem({
|
|
132
|
+
useRefreshedItemHeight: expVal('platform_editor_agent_mentions', 'isEnabled', false)
|
|
133
|
+
})(mention);
|
|
129
134
|
};
|
|
130
135
|
|
|
131
136
|
/**
|
|
@@ -154,12 +159,12 @@ export function memoize(fn
|
|
|
154
159
|
};
|
|
155
160
|
}
|
|
156
161
|
var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAheadAnalytics(fireEvent) {
|
|
157
|
-
return function (
|
|
158
|
-
var query =
|
|
159
|
-
mentions =
|
|
160
|
-
stats =
|
|
161
|
-
mentionTypeaheadSessionId =
|
|
162
|
-
agentAnalytics =
|
|
162
|
+
return function (_ref6) {
|
|
163
|
+
var query = _ref6.query,
|
|
164
|
+
mentions = _ref6.mentions,
|
|
165
|
+
stats = _ref6.stats,
|
|
166
|
+
mentionTypeaheadSessionId = _ref6.mentionTypeaheadSessionId,
|
|
167
|
+
agentAnalytics = _ref6.agentAnalytics;
|
|
163
168
|
var duration = 0;
|
|
164
169
|
var userOrTeamIds = null;
|
|
165
170
|
var teams = null;
|
|
@@ -261,19 +266,19 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
261
266
|
* `createTypeAheadConfig` and intentionally mutated here as a
|
|
262
267
|
* side-effect — preserves the existing single-shot semantics.
|
|
263
268
|
*/
|
|
264
|
-
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(
|
|
265
|
-
var fireEvent =
|
|
266
|
-
getFirstQueryWithoutResults =
|
|
267
|
-
setFirstQueryWithoutResults =
|
|
268
|
-
toItem =
|
|
269
|
-
enableAgentSectioning =
|
|
270
|
-
return function (
|
|
271
|
-
var mentions =
|
|
272
|
-
query =
|
|
273
|
-
stats =
|
|
274
|
-
mentionProvider =
|
|
275
|
-
contextIdentifierProvider =
|
|
276
|
-
sessionId =
|
|
269
|
+
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(_ref7) {
|
|
270
|
+
var fireEvent = _ref7.fireEvent,
|
|
271
|
+
getFirstQueryWithoutResults = _ref7.getFirstQueryWithoutResults,
|
|
272
|
+
setFirstQueryWithoutResults = _ref7.setFirstQueryWithoutResults,
|
|
273
|
+
toItem = _ref7.toItem,
|
|
274
|
+
enableAgentSectioning = _ref7.enableAgentSectioning;
|
|
275
|
+
return function (_ref8) {
|
|
276
|
+
var mentions = _ref8.mentions,
|
|
277
|
+
query = _ref8.query,
|
|
278
|
+
stats = _ref8.stats,
|
|
279
|
+
mentionProvider = _ref8.mentionProvider,
|
|
280
|
+
contextIdentifierProvider = _ref8.contextIdentifierProvider,
|
|
281
|
+
sessionId = _ref8.sessionId;
|
|
277
282
|
var mentionItems = mentions.map(function (mention) {
|
|
278
283
|
return toItem(mention);
|
|
279
284
|
});
|
|
@@ -320,17 +325,18 @@ var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToType
|
|
|
320
325
|
})(mentionItems);
|
|
321
326
|
};
|
|
322
327
|
};
|
|
323
|
-
export var createTypeAheadConfig = function createTypeAheadConfig(
|
|
324
|
-
var sanitizePrivateContent =
|
|
325
|
-
mentionInsertDisplayName =
|
|
326
|
-
fireEvent =
|
|
327
|
-
HighlightComponent =
|
|
328
|
-
api =
|
|
329
|
-
handleMentionsChanged =
|
|
330
|
-
|
|
331
|
-
enableAgentSectioning =
|
|
332
|
-
|
|
333
|
-
showAgentMentionsLabsLozenge =
|
|
328
|
+
export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
329
|
+
var sanitizePrivateContent = _ref9.sanitizePrivateContent,
|
|
330
|
+
mentionInsertDisplayName = _ref9.mentionInsertDisplayName,
|
|
331
|
+
fireEvent = _ref9.fireEvent,
|
|
332
|
+
HighlightComponent = _ref9.HighlightComponent,
|
|
333
|
+
api = _ref9.api,
|
|
334
|
+
handleMentionsChanged = _ref9.handleMentionsChanged,
|
|
335
|
+
_ref9$enableAgentSect = _ref9.enableAgentSectioning,
|
|
336
|
+
enableAgentSectioning = _ref9$enableAgentSect === void 0 ? false : _ref9$enableAgentSect,
|
|
337
|
+
_ref9$showAgentMentio = _ref9.showAgentMentionsLabsLozenge,
|
|
338
|
+
showAgentMentionsLabsLozenge = _ref9$showAgentMentio === void 0 ? false : _ref9$showAgentMentio,
|
|
339
|
+
profilecardProvider = _ref9.profilecardProvider;
|
|
334
340
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
335
341
|
var sessionId = uuid();
|
|
336
342
|
var firstQueryWithoutResults = null;
|
|
@@ -344,7 +350,10 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref8) {
|
|
|
344
350
|
setFirstQueryWithoutResults: function setFirstQueryWithoutResults(query) {
|
|
345
351
|
firstQueryWithoutResults = query;
|
|
346
352
|
},
|
|
347
|
-
toItem: memoize(makeMentionToTypeaheadItem(
|
|
353
|
+
toItem: memoize(makeMentionToTypeaheadItem({
|
|
354
|
+
useRefreshedItemHeight: enableAgentSectioning,
|
|
355
|
+
profilecardProvider: profilecardProvider
|
|
356
|
+
})).call
|
|
348
357
|
});
|
|
349
358
|
var typeAhead = {
|
|
350
359
|
id: TypeAheadAvailableNodes.MENTION,
|
|
@@ -359,17 +368,17 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref8) {
|
|
|
359
368
|
}
|
|
360
369
|
return null;
|
|
361
370
|
},
|
|
362
|
-
getItems: function getItems(
|
|
371
|
+
getItems: function getItems(_ref0) {
|
|
363
372
|
var _api$contextIdentifie, _api$contextIdentifie2;
|
|
364
|
-
var query =
|
|
365
|
-
editorState =
|
|
373
|
+
var query = _ref0.query,
|
|
374
|
+
editorState = _ref0.editorState;
|
|
366
375
|
var pluginState = getMentionPluginState(editorState);
|
|
367
376
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
368
377
|
return Promise.resolve([]);
|
|
369
378
|
}
|
|
370
379
|
var mentionProvider = pluginState.mentionProvider;
|
|
371
|
-
var
|
|
372
|
-
contextIdentifierProvider =
|
|
380
|
+
var _ref1 = (_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 : {},
|
|
381
|
+
contextIdentifierProvider = _ref1.contextIdentifierProvider;
|
|
373
382
|
return new Promise(function (resolve, reject) {
|
|
374
383
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
375
384
|
var key = "loadingMentionsForTypeAhead_".concat(uuid());
|
|
@@ -404,8 +413,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref8) {
|
|
|
404
413
|
}));
|
|
405
414
|
});
|
|
406
415
|
},
|
|
407
|
-
getSections: function getSections(
|
|
408
|
-
var intl =
|
|
416
|
+
getSections: function getSections(_ref10) {
|
|
417
|
+
var intl = _ref10.intl;
|
|
409
418
|
if (!enableAgentSectioning) {
|
|
410
419
|
return [];
|
|
411
420
|
}
|
|
@@ -439,12 +448,12 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref8) {
|
|
|
439
448
|
onOpen: function onOpen() {
|
|
440
449
|
firstQueryWithoutResults = null;
|
|
441
450
|
},
|
|
442
|
-
selectItem: function selectItem(state, item, insert,
|
|
451
|
+
selectItem: function selectItem(state, item, insert, _ref11) {
|
|
443
452
|
var _api$contextIdentifie3, _api$contextIdentifie4;
|
|
444
|
-
var mode =
|
|
445
|
-
stats =
|
|
446
|
-
query =
|
|
447
|
-
sourceListItem =
|
|
453
|
+
var mode = _ref11.mode,
|
|
454
|
+
stats = _ref11.stats,
|
|
455
|
+
query = _ref11.query,
|
|
456
|
+
sourceListItem = _ref11.sourceListItem;
|
|
448
457
|
var schema = state.schema;
|
|
449
458
|
|
|
450
459
|
// Placeholder isn't selectable. Return `false` (not a transaction) so
|
|
@@ -461,8 +470,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref8) {
|
|
|
461
470
|
accessLevel = _item$mention.accessLevel,
|
|
462
471
|
userType = _item$mention.userType,
|
|
463
472
|
isXProductUser = _item$mention.isXProductUser;
|
|
464
|
-
var
|
|
465
|
-
contextIdentifierProvider =
|
|
473
|
+
var _ref12 = (_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 : {},
|
|
474
|
+
contextIdentifierProvider = _ref12.contextIdentifierProvider;
|
|
466
475
|
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
467
476
|
sessionId: sessionId
|
|
468
477
|
});
|
|
@@ -589,11 +598,11 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref8) {
|
|
|
589
598
|
}
|
|
590
599
|
return tr;
|
|
591
600
|
},
|
|
592
|
-
dismiss: function dismiss(
|
|
593
|
-
var editorState =
|
|
594
|
-
query =
|
|
595
|
-
stats =
|
|
596
|
-
wasItemInserted =
|
|
601
|
+
dismiss: function dismiss(_ref13) {
|
|
602
|
+
var editorState = _ref13.editorState,
|
|
603
|
+
query = _ref13.query,
|
|
604
|
+
stats = _ref13.stats,
|
|
605
|
+
wasItemInserted = _ref13.wasItemInserted;
|
|
597
606
|
firstQueryWithoutResults = null;
|
|
598
607
|
var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
|
|
599
608
|
if (!wasItemInserted) {
|
|
@@ -637,10 +646,10 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref8) {
|
|
|
637
646
|
* so we only attach it when the gate is on — otherwise the proven
|
|
638
647
|
* single-shot `getItems` path continues to drive every consumer.
|
|
639
648
|
*/
|
|
640
|
-
var subscribeToItemsUpdates = function subscribeToItemsUpdates(
|
|
649
|
+
var subscribeToItemsUpdates = function subscribeToItemsUpdates(_ref14) {
|
|
641
650
|
var _api$contextIdentifie5, _api$contextIdentifie6;
|
|
642
|
-
var query =
|
|
643
|
-
editorState =
|
|
651
|
+
var query = _ref14.query,
|
|
652
|
+
editorState = _ref14.editorState;
|
|
644
653
|
var pluginState = getMentionPluginState(editorState);
|
|
645
654
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
646
655
|
return {
|
|
@@ -651,8 +660,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref8) {
|
|
|
651
660
|
};
|
|
652
661
|
}
|
|
653
662
|
var mentionProvider = pluginState.mentionProvider;
|
|
654
|
-
var
|
|
655
|
-
contextIdentifierProvider =
|
|
663
|
+
var _ref15 = (_api$contextIdentifie5 = api === null || api === void 0 || (_api$contextIdentifie6 = api.contextIdentifier) === null || _api$contextIdentifie6 === void 0 ? void 0 : _api$contextIdentifie6.sharedState.currentState()) !== null && _api$contextIdentifie5 !== void 0 ? _api$contextIdentifie5 : {},
|
|
664
|
+
contextIdentifierProvider = _ref15.contextIdentifierProvider;
|
|
656
665
|
|
|
657
666
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
658
667
|
var key = "loadingMentionsForTypeAhead_".concat(uuid());
|
|
@@ -18,6 +18,12 @@ export var isTeamStats = function isTeamStats(stat) {
|
|
|
18
18
|
export var isInviteItem = function isInviteItem(mention) {
|
|
19
19
|
return mention && mention.id === INVITE_ITEM_DESCRIPTION.id;
|
|
20
20
|
};
|
|
21
|
+
export var isAgentUserType = function isAgentUserType(userType) {
|
|
22
|
+
return userType === 'APP' || userType === 'AGENT';
|
|
23
|
+
};
|
|
24
|
+
export var isAgentMention = function isAgentMention(mention) {
|
|
25
|
+
return isAgentUserType(mention.userType) || mention.appType === 'agent';
|
|
26
|
+
};
|
|
21
27
|
|
|
22
28
|
/**
|
|
23
29
|
* Actions
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
import { useEffect } from 'react';
|
|
7
7
|
import createFocusTrap from 'focus-trap';
|
|
8
8
|
export var useFocusTrap = function useFocusTrap(_ref) {
|
|
9
|
-
var targetRef = _ref.targetRef
|
|
9
|
+
var targetRef = _ref.targetRef,
|
|
10
|
+
_ref$enabled = _ref.enabled,
|
|
11
|
+
enabled = _ref$enabled === void 0 ? true : _ref$enabled;
|
|
10
12
|
useEffect(function () {
|
|
11
|
-
if (!targetRef) {
|
|
13
|
+
if (!targetRef || !enabled) {
|
|
12
14
|
return;
|
|
13
15
|
}
|
|
14
16
|
var trapConfig = {
|
|
@@ -32,5 +34,5 @@ export var useFocusTrap = function useFocusTrap(_ref) {
|
|
|
32
34
|
}
|
|
33
35
|
focusTrap.deactivate();
|
|
34
36
|
};
|
|
35
|
-
}, [targetRef]);
|
|
37
|
+
}, [targetRef, enabled]);
|
|
36
38
|
};
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { PropsWithChildren } from 'react';
|
|
3
|
-
import type { PopperChildrenProps } from '@atlaskit/popper';
|
|
3
|
+
import type { PopperChildrenProps, Placement } from '@atlaskit/popper/main';
|
|
4
4
|
interface Props {
|
|
5
5
|
/**
|
|
6
6
|
* Returns the element to be positioned.
|
|
7
7
|
*/
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* When true, the popup does not trap focus.
|
|
11
|
+
*/
|
|
12
|
+
disableFocusTrap?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Popper offset. Defaults to `[0, 8]`.
|
|
15
|
+
*/
|
|
16
|
+
offset?: [number, number];
|
|
17
|
+
/**
|
|
18
|
+
* Where to place the popup relative to the reference element.
|
|
19
|
+
* Defaults to `bottom-end`.
|
|
20
|
+
*/
|
|
21
|
+
placement?: Placement;
|
|
9
22
|
/**
|
|
10
23
|
* Replacement reference element to position popper relative to.
|
|
11
24
|
*/
|
|
@@ -25,5 +38,5 @@ export declare const RepositionOnUpdate: ({ children, update, }: PropsWithChildr
|
|
|
25
38
|
* @param children React.ReactNode - Returns the element to be positioned.
|
|
26
39
|
* @returns React popper component
|
|
27
40
|
*/
|
|
28
|
-
export declare function Popup({ referenceElement, children }: Props): React.JSX.Element;
|
|
41
|
+
export declare function Popup({ referenceElement, children, placement, offset, disableFocusTrap, }: Props): React.JSX.Element;
|
|
29
42
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MentionAttributes } from '@atlaskit/adf-schema/mention';
|
|
2
2
|
import type { DocNode } from '@atlaskit/adf-schema/schema';
|
|
3
3
|
import type { ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { Placement } from '@atlaskit/popper/main';
|
|
4
5
|
import type { ProfileCardClientData, TeamCentralReportingLinesData } from '@atlaskit/profilecard/types';
|
|
5
6
|
interface ProfileCardStateProps {
|
|
6
7
|
id: string | undefined;
|
|
@@ -18,13 +19,17 @@ export declare const useProfileCardState: ({ id, provider, }: ProfileCardStatePr
|
|
|
18
19
|
/**
|
|
19
20
|
* Renders the profile card popup for an editor mention node.
|
|
20
21
|
*/
|
|
21
|
-
export declare function ProfileCardComponent({ profilecardProvider, activeMention, dom, closeComponent, onAgentMentionChatClick, }: {
|
|
22
|
+
export declare function ProfileCardComponent({ profilecardProvider, activeMention, dom, closeComponent, onAgentMentionChatClick, placement, offset, disableFocusTrap, hideActions, }: {
|
|
22
23
|
activeMention: {
|
|
23
24
|
attrs: MentionAttributes;
|
|
24
25
|
};
|
|
25
26
|
closeComponent: () => void;
|
|
27
|
+
disableFocusTrap?: boolean;
|
|
26
28
|
dom: HTMLElement;
|
|
29
|
+
hideActions?: boolean;
|
|
30
|
+
offset?: [number, number];
|
|
27
31
|
onAgentMentionChatClick?: (agentId: string, agentMentionContext?: DocNode) => void;
|
|
32
|
+
placement?: Placement;
|
|
28
33
|
profilecardProvider?: Promise<ProfilecardProvider> | undefined;
|
|
29
34
|
}): JSX.Element;
|
|
30
35
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
3
|
+
type Props = {
|
|
4
|
+
height?: number;
|
|
5
|
+
mention: MentionDescription;
|
|
6
|
+
onSelection: () => void;
|
|
7
|
+
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
8
|
+
selected?: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Renders a mentions typeahead row that shows a (reduced) profile card
|
|
12
|
+
* when hovered
|
|
13
|
+
*/
|
|
14
|
+
export declare function MentionItemWithProfileCard({ mention, selected, onSelection, height, profilecardProvider, }: Props): JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
2
3
|
import type { ExtractInjectionAPI, TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
4
5
|
import type { MentionsPlugin } from '../../mentionsPluginType';
|
|
@@ -18,8 +19,9 @@ type Props = {
|
|
|
18
19
|
handleMentionsChanged?: (mentionChanges: MentionChange[]) => void;
|
|
19
20
|
HighlightComponent?: React.ComponentType<React.PropsWithChildren<unknown>>;
|
|
20
21
|
mentionInsertDisplayName?: boolean;
|
|
22
|
+
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
21
23
|
sanitizePrivateContent?: boolean;
|
|
22
24
|
showAgentMentionsLabsLozenge?: boolean;
|
|
23
25
|
};
|
|
24
|
-
export declare const createTypeAheadConfig: ({ sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, api, handleMentionsChanged, enableAgentSectioning, showAgentMentionsLabsLozenge, }: Props) => TypeAheadHandler;
|
|
26
|
+
export declare const createTypeAheadConfig: ({ sanitizePrivateContent, mentionInsertDisplayName, fireEvent, HighlightComponent, api, handleMentionsChanged, enableAgentSectioning, showAgentMentionsLabsLozenge, profilecardProvider, }: Props) => TypeAheadHandler;
|
|
25
27
|
export {};
|
|
@@ -2,6 +2,8 @@ import type { MentionDescription } from '@atlaskit/mention';
|
|
|
2
2
|
export declare const isTeamType: (userType: any) => boolean;
|
|
3
3
|
export declare const isTeamStats: (stat: any) => boolean;
|
|
4
4
|
export declare const isInviteItem: (mention: MentionDescription) => boolean;
|
|
5
|
+
export declare const isAgentUserType: (userType: string | undefined) => boolean;
|
|
6
|
+
export declare const isAgentMention: (mention: Pick<MentionDescription, 'appType' | 'userType'>) => boolean;
|
|
5
7
|
/**
|
|
6
8
|
* Actions
|
|
7
9
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "17.0
|
|
3
|
+
"version": "17.1.0",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"@atlaskit/editor-plugin-base": "^16.0.0",
|
|
29
29
|
"@atlaskit/editor-plugin-context-identifier": "^15.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-selection": "^15.0.0",
|
|
31
|
-
"@atlaskit/editor-plugin-type-ahead": "^16.
|
|
31
|
+
"@atlaskit/editor-plugin-type-ahead": "^16.1.0",
|
|
32
32
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
33
33
|
"@atlaskit/feature-gate-js-client": "^6.0.0",
|
|
34
34
|
"@atlaskit/icon": "^37.3.0",
|
|
35
35
|
"@atlaskit/insm": "^2.0.0",
|
|
36
36
|
"@atlaskit/link": "^5.0.0",
|
|
37
37
|
"@atlaskit/lozenge": "^15.0.0",
|
|
38
|
-
"@atlaskit/mention": "^27.
|
|
38
|
+
"@atlaskit/mention": "^27.17.0",
|
|
39
39
|
"@atlaskit/node-data-provider": "^16.0.0",
|
|
40
40
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
41
41
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/popup": "^6.0.0",
|
|
44
44
|
"@atlaskit/portal": "^6.2.0",
|
|
45
45
|
"@atlaskit/primitives": "^22.2.0",
|
|
46
|
-
"@atlaskit/profilecard": "^26.
|
|
46
|
+
"@atlaskit/profilecard": "^26.18.0",
|
|
47
47
|
"@atlaskit/teams-app-config": "^2.2.0",
|
|
48
48
|
"@atlaskit/theme": "^28.0.0",
|
|
49
49
|
"@atlaskit/tmp-editor-statsig": "^147.1.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"uuid": "^3.1.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@atlaskit/editor-common": "^119.
|
|
61
|
+
"@atlaskit/editor-common": "^119.2.0",
|
|
62
62
|
"react": "^18.2.0 || ^19.2.0",
|
|
63
63
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
64
64
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
},
|
|
128
128
|
"platform_editor_agent_mentions_drop_one_fixes": {
|
|
129
129
|
"type": "boolean"
|
|
130
|
+
},
|
|
131
|
+
"platform_editor_mention_typeahead_profilecard": {
|
|
132
|
+
"type": "boolean"
|
|
130
133
|
}
|
|
131
134
|
},
|
|
132
135
|
"platform-experiments": {
|