@atlaskit/editor-plugin-mentions 18.2.2 → 18.2.4
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 +15 -0
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/ui/type-ahead/MentionItemWithProfileCard.compiled.css +2 -0
- package/dist/cjs/ui/type-ahead/MentionItemWithProfileCard.js +22 -0
- package/dist/cjs/ui/type-ahead/index.js +92 -59
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/ui/type-ahead/MentionItemWithProfileCard.compiled.css +2 -0
- package/dist/es2019/ui/type-ahead/MentionItemWithProfileCard.js +22 -0
- package/dist/es2019/ui/type-ahead/index.js +32 -0
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/ui/type-ahead/MentionItemWithProfileCard.compiled.css +2 -0
- package/dist/esm/ui/type-ahead/MentionItemWithProfileCard.js +22 -0
- package/dist/esm/ui/type-ahead/index.js +92 -59
- package/package.json +2 -39
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 18.2.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4cc06eff6f3d1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4cc06eff6f3d1) -
|
|
8
|
+
[ux] Behind platform_editor_mention_search_order, allow mention item subscription when sectioning
|
|
9
|
+
is enabled and keep loading rows non-interactive
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 18.2.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 18.2.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -74,7 +74,7 @@ var AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
|
|
|
74
74
|
var AGENT_MENTION_INACTIVITY_MS = 3000;
|
|
75
75
|
var MAX_PENDING_TYPED_AGENT_MENTION_FOCUS_DEFERS = 20;
|
|
76
76
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
77
|
-
var PACKAGE_VERSION = "18.2.
|
|
77
|
+
var PACKAGE_VERSION = "18.2.3";
|
|
78
78
|
var setProvider = function setProvider(provider) {
|
|
79
79
|
return function (state, dispatch) {
|
|
80
80
|
if (dispatch) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* MentionItemWithProfileCard.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -6,9 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
7
|
value: true
|
|
7
8
|
});
|
|
8
9
|
exports.MentionItemWithProfileCard = MentionItemWithProfileCard;
|
|
10
|
+
require("./MentionItemWithProfileCard.compiled.css");
|
|
11
|
+
var _runtime = require("@compiled/react/runtime");
|
|
9
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
14
|
var _item = require("@atlaskit/mention/item");
|
|
15
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
12
16
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
17
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
18
|
var _ProfileCardComponent = require("../ProfileCardComponent");
|
|
@@ -19,6 +23,10 @@ var SHOW_DELAY_MS = 600;
|
|
|
19
23
|
var HIDE_DELAY_MS = 200;
|
|
20
24
|
// Gap between the typeahead row and the profile card
|
|
21
25
|
var CARD_GAP_PX = 8;
|
|
26
|
+
var styles = {
|
|
27
|
+
placeholderContainer: "_80om73ad",
|
|
28
|
+
placeholderContent: "_lcxvglyw"
|
|
29
|
+
};
|
|
22
30
|
function getScrollbarWidth(row) {
|
|
23
31
|
var node = row;
|
|
24
32
|
while (node) {
|
|
@@ -104,6 +112,20 @@ function MentionItemWithProfileCard(_ref) {
|
|
|
104
112
|
}
|
|
105
113
|
return [0, CARD_GAP_PX + getScrollbarWidth(referenceElement)];
|
|
106
114
|
}, [referenceElement]);
|
|
115
|
+
if (mention.isPlaceholder && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_search_order')) {
|
|
116
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
117
|
+
testId: "mention-item-with-profile-card",
|
|
118
|
+
xcss: styles.placeholderContainer
|
|
119
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
120
|
+
xcss: styles.placeholderContent
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement(_item.MentionItem, {
|
|
122
|
+
mention: mention,
|
|
123
|
+
selected: selected,
|
|
124
|
+
onMouseEnter: handleMouseEnter,
|
|
125
|
+
onSelection: onSelection,
|
|
126
|
+
height: height
|
|
127
|
+
})));
|
|
128
|
+
}
|
|
107
129
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
108
130
|
testId: "mention-item-with-profile-card",
|
|
109
131
|
onMouseOver: cancelHide,
|
|
@@ -118,12 +118,33 @@ var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(_ref4) {
|
|
|
118
118
|
profilecardProvider = _ref4.profilecardProvider;
|
|
119
119
|
return function (mention) {
|
|
120
120
|
var itemHeight = useRefreshedItemHeight ? _item.MENTION_ITEM_HEIGHT_REFRESHED : _item.MENTION_ITEM_HEIGHT;
|
|
121
|
+
if (isLoadingPlaceholder(mention) && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_search_order')) {
|
|
122
|
+
return {
|
|
123
|
+
title: mention.id,
|
|
124
|
+
isNonInteractive: true,
|
|
125
|
+
render: function render(_ref5) {
|
|
126
|
+
var isSelected = _ref5.isSelected,
|
|
127
|
+
onClick = _ref5.onClick;
|
|
128
|
+
return /*#__PURE__*/_react.default.createElement(_MentionItemWithProfileCard.MentionItemWithProfileCard, {
|
|
129
|
+
mention: mention,
|
|
130
|
+
selected: isSelected,
|
|
131
|
+
onSelection: onClick,
|
|
132
|
+
height: itemHeight,
|
|
133
|
+
profilecardProvider: profilecardProvider
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
getCustomComponentHeight: function getCustomComponentHeight() {
|
|
137
|
+
return itemHeight;
|
|
138
|
+
},
|
|
139
|
+
mention: mention
|
|
140
|
+
};
|
|
141
|
+
}
|
|
121
142
|
return {
|
|
122
143
|
title: mention.id,
|
|
123
|
-
render: function render(
|
|
124
|
-
var isSelected =
|
|
125
|
-
onClick =
|
|
126
|
-
onHover =
|
|
144
|
+
render: function render(_ref6) {
|
|
145
|
+
var isSelected = _ref6.isSelected,
|
|
146
|
+
onClick = _ref6.onClick,
|
|
147
|
+
onHover = _ref6.onHover;
|
|
127
148
|
return (0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false) && (0, _fg.fg)('platform_editor_mention_typeahead_profilecard') ? /*#__PURE__*/_react.default.createElement(_MentionItemWithProfileCard.MentionItemWithProfileCard, {
|
|
128
149
|
mention: mention,
|
|
129
150
|
selected: isSelected,
|
|
@@ -177,12 +198,12 @@ function memoize(fn
|
|
|
177
198
|
};
|
|
178
199
|
}
|
|
179
200
|
var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAheadAnalytics(fireEvent) {
|
|
180
|
-
return function (
|
|
181
|
-
var query =
|
|
182
|
-
mentions =
|
|
183
|
-
stats =
|
|
184
|
-
mentionTypeaheadSessionId =
|
|
185
|
-
agentAnalytics =
|
|
201
|
+
return function (_ref7) {
|
|
202
|
+
var query = _ref7.query,
|
|
203
|
+
mentions = _ref7.mentions,
|
|
204
|
+
stats = _ref7.stats,
|
|
205
|
+
mentionTypeaheadSessionId = _ref7.mentionTypeaheadSessionId,
|
|
206
|
+
agentAnalytics = _ref7.agentAnalytics;
|
|
186
207
|
var duration = 0;
|
|
187
208
|
var userOrTeamIds = null;
|
|
188
209
|
var teams = null;
|
|
@@ -284,19 +305,19 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
284
305
|
* `createTypeAheadConfig` and intentionally mutated here as a
|
|
285
306
|
* side-effect — preserves the existing single-shot semantics.
|
|
286
307
|
*/
|
|
287
|
-
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(
|
|
288
|
-
var fireEvent =
|
|
289
|
-
getFirstQueryWithoutResults =
|
|
290
|
-
setFirstQueryWithoutResults =
|
|
291
|
-
toItem =
|
|
292
|
-
enableAgentSectioning =
|
|
293
|
-
return function (
|
|
294
|
-
var mentions =
|
|
295
|
-
query =
|
|
296
|
-
stats =
|
|
297
|
-
mentionProvider =
|
|
298
|
-
contextIdentifierProvider =
|
|
299
|
-
sessionId =
|
|
308
|
+
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(_ref8) {
|
|
309
|
+
var fireEvent = _ref8.fireEvent,
|
|
310
|
+
getFirstQueryWithoutResults = _ref8.getFirstQueryWithoutResults,
|
|
311
|
+
setFirstQueryWithoutResults = _ref8.setFirstQueryWithoutResults,
|
|
312
|
+
toItem = _ref8.toItem,
|
|
313
|
+
enableAgentSectioning = _ref8.enableAgentSectioning;
|
|
314
|
+
return function (_ref9) {
|
|
315
|
+
var mentions = _ref9.mentions,
|
|
316
|
+
query = _ref9.query,
|
|
317
|
+
stats = _ref9.stats,
|
|
318
|
+
mentionProvider = _ref9.mentionProvider,
|
|
319
|
+
contextIdentifierProvider = _ref9.contextIdentifierProvider,
|
|
320
|
+
sessionId = _ref9.sessionId;
|
|
300
321
|
var displayMentions = shouldApplyMentionSearchOrder(query) ? (0, _utils3.orderMentionsForDisplay)(mentions) : mentions;
|
|
301
322
|
var mentionItems = displayMentions.map(function (mention) {
|
|
302
323
|
return toItem(mention);
|
|
@@ -344,18 +365,18 @@ var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToType
|
|
|
344
365
|
})(mentionItems);
|
|
345
366
|
};
|
|
346
367
|
};
|
|
347
|
-
var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeAheadConfig(
|
|
348
|
-
var sanitizePrivateContent =
|
|
349
|
-
mentionInsertDisplayName =
|
|
350
|
-
fireEvent =
|
|
351
|
-
HighlightComponent =
|
|
352
|
-
api =
|
|
353
|
-
handleMentionsChanged =
|
|
354
|
-
|
|
355
|
-
enableAgentSectioning =
|
|
356
|
-
|
|
357
|
-
showAgentMentionsLabsLozenge =
|
|
358
|
-
profilecardProvider =
|
|
368
|
+
var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
369
|
+
var sanitizePrivateContent = _ref0.sanitizePrivateContent,
|
|
370
|
+
mentionInsertDisplayName = _ref0.mentionInsertDisplayName,
|
|
371
|
+
fireEvent = _ref0.fireEvent,
|
|
372
|
+
HighlightComponent = _ref0.HighlightComponent,
|
|
373
|
+
api = _ref0.api,
|
|
374
|
+
handleMentionsChanged = _ref0.handleMentionsChanged,
|
|
375
|
+
_ref0$enableAgentSect = _ref0.enableAgentSectioning,
|
|
376
|
+
enableAgentSectioning = _ref0$enableAgentSect === void 0 ? false : _ref0$enableAgentSect,
|
|
377
|
+
_ref0$showAgentMentio = _ref0.showAgentMentionsLabsLozenge,
|
|
378
|
+
showAgentMentionsLabsLozenge = _ref0$showAgentMentio === void 0 ? false : _ref0$showAgentMentio,
|
|
379
|
+
profilecardProvider = _ref0.profilecardProvider;
|
|
359
380
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
360
381
|
var sessionId = (0, _uuid.default)();
|
|
361
382
|
var firstQueryWithoutResults = null;
|
|
@@ -388,18 +409,18 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
388
409
|
}
|
|
389
410
|
return null;
|
|
390
411
|
},
|
|
391
|
-
getItems: function getItems(
|
|
412
|
+
getItems: function getItems(_ref1) {
|
|
392
413
|
var _api$contextIdentifie, _api$contextIdentifie2;
|
|
393
|
-
var query =
|
|
394
|
-
editorState =
|
|
414
|
+
var query = _ref1.query,
|
|
415
|
+
editorState = _ref1.editorState;
|
|
395
416
|
lastTypeAheadQuery = query || '';
|
|
396
417
|
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
397
418
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
398
419
|
return Promise.resolve([]);
|
|
399
420
|
}
|
|
400
421
|
var mentionProvider = pluginState.mentionProvider;
|
|
401
|
-
var
|
|
402
|
-
contextIdentifierProvider =
|
|
422
|
+
var _ref10 = (_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 : {},
|
|
423
|
+
contextIdentifierProvider = _ref10.contextIdentifierProvider;
|
|
403
424
|
return new Promise(function (resolve, reject) {
|
|
404
425
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
405
426
|
var key = "loadingMentionsForTypeAhead_".concat((0, _uuid.default)());
|
|
@@ -434,8 +455,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
434
455
|
}));
|
|
435
456
|
});
|
|
436
457
|
},
|
|
437
|
-
getSections: function getSections(
|
|
438
|
-
var intl =
|
|
458
|
+
getSections: function getSections(_ref11) {
|
|
459
|
+
var intl = _ref11.intl;
|
|
439
460
|
if (!enableAgentSectioning) {
|
|
440
461
|
return [];
|
|
441
462
|
}
|
|
@@ -479,12 +500,12 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
479
500
|
firstQueryWithoutResults = null;
|
|
480
501
|
lastTypeAheadQuery = '';
|
|
481
502
|
},
|
|
482
|
-
selectItem: function selectItem(state, item, insert,
|
|
503
|
+
selectItem: function selectItem(state, item, insert, _ref12) {
|
|
483
504
|
var _api$contextIdentifie3, _api$contextIdentifie4;
|
|
484
|
-
var mode =
|
|
485
|
-
stats =
|
|
486
|
-
query =
|
|
487
|
-
sourceListItem =
|
|
505
|
+
var mode = _ref12.mode,
|
|
506
|
+
stats = _ref12.stats,
|
|
507
|
+
query = _ref12.query,
|
|
508
|
+
sourceListItem = _ref12.sourceListItem;
|
|
488
509
|
var schema = state.schema;
|
|
489
510
|
|
|
490
511
|
// Placeholder isn't selectable. Return `false` (not a transaction) so
|
|
@@ -501,8 +522,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
501
522
|
accessLevel = _item$mention.accessLevel,
|
|
502
523
|
userType = _item$mention.userType,
|
|
503
524
|
isXProductUser = _item$mention.isXProductUser;
|
|
504
|
-
var
|
|
505
|
-
contextIdentifierProvider =
|
|
525
|
+
var _ref13 = (_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 : {},
|
|
526
|
+
contextIdentifierProvider = _ref13.contextIdentifierProvider;
|
|
506
527
|
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
507
528
|
sessionId: sessionId
|
|
508
529
|
});
|
|
@@ -629,11 +650,11 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
629
650
|
}
|
|
630
651
|
return tr;
|
|
631
652
|
},
|
|
632
|
-
dismiss: function dismiss(
|
|
633
|
-
var editorState =
|
|
634
|
-
query =
|
|
635
|
-
stats =
|
|
636
|
-
wasItemInserted =
|
|
653
|
+
dismiss: function dismiss(_ref14) {
|
|
654
|
+
var editorState = _ref14.editorState,
|
|
655
|
+
query = _ref14.query,
|
|
656
|
+
stats = _ref14.stats,
|
|
657
|
+
wasItemInserted = _ref14.wasItemInserted;
|
|
637
658
|
firstQueryWithoutResults = null;
|
|
638
659
|
var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
|
|
639
660
|
if (!wasItemInserted) {
|
|
@@ -677,10 +698,10 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
677
698
|
* so we only attach it when the gate is on — otherwise the proven
|
|
678
699
|
* single-shot `getItems` path continues to drive every consumer.
|
|
679
700
|
*/
|
|
680
|
-
var subscribeToItemsUpdates = function subscribeToItemsUpdates(
|
|
701
|
+
var subscribeToItemsUpdates = function subscribeToItemsUpdates(_ref15) {
|
|
681
702
|
var _api$contextIdentifie5, _api$contextIdentifie6;
|
|
682
|
-
var query =
|
|
683
|
-
editorState =
|
|
703
|
+
var query = _ref15.query,
|
|
704
|
+
editorState = _ref15.editorState;
|
|
684
705
|
lastTypeAheadQuery = query || '';
|
|
685
706
|
var pluginState = (0, _utils2.getMentionPluginState)(editorState);
|
|
686
707
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
@@ -692,8 +713,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
692
713
|
};
|
|
693
714
|
}
|
|
694
715
|
var mentionProvider = pluginState.mentionProvider;
|
|
695
|
-
var
|
|
696
|
-
contextIdentifierProvider =
|
|
716
|
+
var _ref16 = (_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 : {},
|
|
717
|
+
contextIdentifierProvider = _ref16.contextIdentifierProvider;
|
|
697
718
|
|
|
698
719
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
699
720
|
var key = "loadingMentionsForTypeAhead_".concat((0, _uuid.default)());
|
|
@@ -701,6 +722,7 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
701
722
|
var initialReject = null;
|
|
702
723
|
var initialResolved = false;
|
|
703
724
|
var updateCallback = null;
|
|
725
|
+
var pendingUpdate = null;
|
|
704
726
|
var unsubscribed = false;
|
|
705
727
|
var initial = new Promise(function (resolve, reject) {
|
|
706
728
|
initialResolve = resolve;
|
|
@@ -729,6 +751,9 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
729
751
|
var _initialResolve;
|
|
730
752
|
initialResolved = true;
|
|
731
753
|
(_initialResolve = initialResolve) === null || _initialResolve === void 0 || _initialResolve(items);
|
|
754
|
+
} else if (enableAgentSectioning && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_search_order') && !updateCallback) {
|
|
755
|
+
// Agent Studio can resolve before the typeahead installs its update subscriber.
|
|
756
|
+
pendingUpdate = items;
|
|
732
757
|
} else {
|
|
733
758
|
var _updateCallback;
|
|
734
759
|
(_updateCallback = updateCallback) === null || _updateCallback === void 0 || _updateCallback(items);
|
|
@@ -756,9 +781,14 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
756
781
|
throw new Error('TypeAhead mention updates support only one subscriber');
|
|
757
782
|
}
|
|
758
783
|
updateCallback = update;
|
|
784
|
+
if (enableAgentSectioning && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_search_order') && pendingUpdate) {
|
|
785
|
+
updateCallback(pendingUpdate);
|
|
786
|
+
pendingUpdate = null;
|
|
787
|
+
}
|
|
759
788
|
return function () {
|
|
760
789
|
unsubscribed = true;
|
|
761
790
|
updateCallback = null;
|
|
791
|
+
pendingUpdate = null;
|
|
762
792
|
mentionProvider.unsubscribe(key);
|
|
763
793
|
subscriptionKeys.delete(key);
|
|
764
794
|
// If cleanup runs before the first emission, settle the initial
|
|
@@ -773,6 +803,9 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
773
803
|
}
|
|
774
804
|
};
|
|
775
805
|
};
|
|
806
|
+
if (enableAgentSectioning && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_mention_search_order')) {
|
|
807
|
+
typeAhead.subscribeToItemsUpdates = subscribeToItemsUpdates;
|
|
808
|
+
}
|
|
776
809
|
|
|
777
810
|
// Presence of `subscribeToItemsUpdates` is how the type-ahead hook
|
|
778
811
|
// opts a handler into the multi-emit path, so only expose it when the
|
|
@@ -58,7 +58,7 @@ const AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
|
|
|
58
58
|
const AGENT_MENTION_INACTIVITY_MS = 3000;
|
|
59
59
|
const MAX_PENDING_TYPED_AGENT_MENTION_FOCUS_DEFERS = 20;
|
|
60
60
|
const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
61
|
-
const PACKAGE_VERSION = "18.2.
|
|
61
|
+
const PACKAGE_VERSION = "18.2.3";
|
|
62
62
|
const setProvider = provider => (state, dispatch) => {
|
|
63
63
|
if (dispatch) {
|
|
64
64
|
dispatch(state.tr.setMeta(mentionPluginKey, {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
/* MentionItemWithProfileCard.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
|
+
import "./MentionItemWithProfileCard.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
1
4
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
5
|
import { MentionItem } from '@atlaskit/mention/item';
|
|
6
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
3
7
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
8
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
5
9
|
import { ProfileCardComponent } from '../ProfileCardComponent';
|
|
@@ -10,6 +14,10 @@ const SHOW_DELAY_MS = 600;
|
|
|
10
14
|
const HIDE_DELAY_MS = 200;
|
|
11
15
|
// Gap between the typeahead row and the profile card
|
|
12
16
|
const CARD_GAP_PX = 8;
|
|
17
|
+
const styles = {
|
|
18
|
+
placeholderContainer: "_80om73ad",
|
|
19
|
+
placeholderContent: "_lcxvglyw"
|
|
20
|
+
};
|
|
13
21
|
function getScrollbarWidth(row) {
|
|
14
22
|
let node = row;
|
|
15
23
|
while (node) {
|
|
@@ -89,6 +97,20 @@ export function MentionItemWithProfileCard({
|
|
|
89
97
|
}
|
|
90
98
|
return [0, CARD_GAP_PX + getScrollbarWidth(referenceElement)];
|
|
91
99
|
}, [referenceElement]);
|
|
100
|
+
if (mention.isPlaceholder && isExperimentEnabled('platform_editor_mention_search_order')) {
|
|
101
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
102
|
+
testId: "mention-item-with-profile-card",
|
|
103
|
+
xcss: styles.placeholderContainer
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
105
|
+
xcss: styles.placeholderContent
|
|
106
|
+
}, /*#__PURE__*/React.createElement(MentionItem, {
|
|
107
|
+
mention: mention,
|
|
108
|
+
selected: selected,
|
|
109
|
+
onMouseEnter: handleMouseEnter,
|
|
110
|
+
onSelection: onSelection,
|
|
111
|
+
height: height
|
|
112
|
+
})));
|
|
113
|
+
}
|
|
92
114
|
return /*#__PURE__*/React.createElement(Box, {
|
|
93
115
|
testId: "mention-item-with-profile-card",
|
|
94
116
|
onMouseOver: cancelHide,
|
|
@@ -91,6 +91,26 @@ const makeMentionToTypeaheadItem = ({
|
|
|
91
91
|
profilecardProvider
|
|
92
92
|
}) => mention => {
|
|
93
93
|
const itemHeight = useRefreshedItemHeight ? MENTION_ITEM_HEIGHT_REFRESHED : MENTION_ITEM_HEIGHT;
|
|
94
|
+
if (isLoadingPlaceholder(mention) && isExperimentEnabled('platform_editor_mention_search_order')) {
|
|
95
|
+
return {
|
|
96
|
+
title: mention.id,
|
|
97
|
+
isNonInteractive: true,
|
|
98
|
+
render: ({
|
|
99
|
+
isSelected,
|
|
100
|
+
onClick
|
|
101
|
+
}) => /*#__PURE__*/React.createElement(MentionItemWithProfileCard, {
|
|
102
|
+
mention: mention,
|
|
103
|
+
selected: isSelected,
|
|
104
|
+
onSelection: onClick,
|
|
105
|
+
height: itemHeight,
|
|
106
|
+
profilecardProvider: profilecardProvider
|
|
107
|
+
}),
|
|
108
|
+
getCustomComponentHeight: () => {
|
|
109
|
+
return itemHeight;
|
|
110
|
+
},
|
|
111
|
+
mention
|
|
112
|
+
};
|
|
113
|
+
}
|
|
94
114
|
return {
|
|
95
115
|
title: mention.id,
|
|
96
116
|
render: ({
|
|
@@ -668,6 +688,7 @@ export const createTypeAheadConfig = ({
|
|
|
668
688
|
let initialReject = null;
|
|
669
689
|
let initialResolved = false;
|
|
670
690
|
let updateCallback = null;
|
|
691
|
+
let pendingUpdate = null;
|
|
671
692
|
let unsubscribed = false;
|
|
672
693
|
const initial = new Promise((resolve, reject) => {
|
|
673
694
|
initialResolve = resolve;
|
|
@@ -694,6 +715,9 @@ export const createTypeAheadConfig = ({
|
|
|
694
715
|
var _initialResolve;
|
|
695
716
|
initialResolved = true;
|
|
696
717
|
(_initialResolve = initialResolve) === null || _initialResolve === void 0 ? void 0 : _initialResolve(items);
|
|
718
|
+
} else if (enableAgentSectioning && isExperimentEnabled('platform_editor_mention_search_order') && !updateCallback) {
|
|
719
|
+
// Agent Studio can resolve before the typeahead installs its update subscriber.
|
|
720
|
+
pendingUpdate = items;
|
|
697
721
|
} else {
|
|
698
722
|
var _updateCallback;
|
|
699
723
|
(_updateCallback = updateCallback) === null || _updateCallback === void 0 ? void 0 : _updateCallback(items);
|
|
@@ -722,9 +746,14 @@ export const createTypeAheadConfig = ({
|
|
|
722
746
|
throw new Error('TypeAhead mention updates support only one subscriber');
|
|
723
747
|
}
|
|
724
748
|
updateCallback = update;
|
|
749
|
+
if (enableAgentSectioning && isExperimentEnabled('platform_editor_mention_search_order') && pendingUpdate) {
|
|
750
|
+
updateCallback(pendingUpdate);
|
|
751
|
+
pendingUpdate = null;
|
|
752
|
+
}
|
|
725
753
|
return () => {
|
|
726
754
|
unsubscribed = true;
|
|
727
755
|
updateCallback = null;
|
|
756
|
+
pendingUpdate = null;
|
|
728
757
|
mentionProvider.unsubscribe(key);
|
|
729
758
|
subscriptionKeys.delete(key);
|
|
730
759
|
// If cleanup runs before the first emission, settle the initial
|
|
@@ -739,6 +768,9 @@ export const createTypeAheadConfig = ({
|
|
|
739
768
|
}
|
|
740
769
|
};
|
|
741
770
|
};
|
|
771
|
+
if (enableAgentSectioning && isExperimentEnabled('platform_editor_mention_search_order')) {
|
|
772
|
+
typeAhead.subscribeToItemsUpdates = subscribeToItemsUpdates;
|
|
773
|
+
}
|
|
742
774
|
|
|
743
775
|
// Presence of `subscribeToItemsUpdates` is how the type-ahead hook
|
|
744
776
|
// opts a handler into the multi-emit path, so only expose it when the
|
|
@@ -65,7 +65,7 @@ var AI_STREAMING_TRANSFORMATION_META_KEY = 'isAIStreamingTransformation';
|
|
|
65
65
|
var AGENT_MENTION_INACTIVITY_MS = 3000;
|
|
66
66
|
var MAX_PENDING_TYPED_AGENT_MENTION_FOCUS_DEFERS = 20;
|
|
67
67
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
68
|
-
var PACKAGE_VERSION = "18.2.
|
|
68
|
+
var PACKAGE_VERSION = "18.2.3";
|
|
69
69
|
var setProvider = function setProvider(provider) {
|
|
70
70
|
return function (state, dispatch) {
|
|
71
71
|
if (dispatch) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
/* MentionItemWithProfileCard.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import "./MentionItemWithProfileCard.compiled.css";
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
2
5
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
6
|
import { MentionItem } from '@atlaskit/mention/item';
|
|
7
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
9
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
10
|
import { ProfileCardComponent } from '../ProfileCardComponent';
|
|
@@ -11,6 +15,10 @@ var SHOW_DELAY_MS = 600;
|
|
|
11
15
|
var HIDE_DELAY_MS = 200;
|
|
12
16
|
// Gap between the typeahead row and the profile card
|
|
13
17
|
var CARD_GAP_PX = 8;
|
|
18
|
+
var styles = {
|
|
19
|
+
placeholderContainer: "_80om73ad",
|
|
20
|
+
placeholderContent: "_lcxvglyw"
|
|
21
|
+
};
|
|
14
22
|
function getScrollbarWidth(row) {
|
|
15
23
|
var node = row;
|
|
16
24
|
while (node) {
|
|
@@ -96,6 +104,20 @@ export function MentionItemWithProfileCard(_ref) {
|
|
|
96
104
|
}
|
|
97
105
|
return [0, CARD_GAP_PX + getScrollbarWidth(referenceElement)];
|
|
98
106
|
}, [referenceElement]);
|
|
107
|
+
if (mention.isPlaceholder && isExperimentEnabled('platform_editor_mention_search_order')) {
|
|
108
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
109
|
+
testId: "mention-item-with-profile-card",
|
|
110
|
+
xcss: styles.placeholderContainer
|
|
111
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
112
|
+
xcss: styles.placeholderContent
|
|
113
|
+
}, /*#__PURE__*/React.createElement(MentionItem, {
|
|
114
|
+
mention: mention,
|
|
115
|
+
selected: selected,
|
|
116
|
+
onMouseEnter: handleMouseEnter,
|
|
117
|
+
onSelection: onSelection,
|
|
118
|
+
height: height
|
|
119
|
+
})));
|
|
120
|
+
}
|
|
99
121
|
return /*#__PURE__*/React.createElement(Box, {
|
|
100
122
|
testId: "mention-item-with-profile-card",
|
|
101
123
|
onMouseOver: cancelHide,
|
|
@@ -109,12 +109,33 @@ var makeMentionToTypeaheadItem = function makeMentionToTypeaheadItem(_ref4) {
|
|
|
109
109
|
profilecardProvider = _ref4.profilecardProvider;
|
|
110
110
|
return function (mention) {
|
|
111
111
|
var itemHeight = useRefreshedItemHeight ? MENTION_ITEM_HEIGHT_REFRESHED : MENTION_ITEM_HEIGHT;
|
|
112
|
+
if (isLoadingPlaceholder(mention) && isExperimentEnabled('platform_editor_mention_search_order')) {
|
|
113
|
+
return {
|
|
114
|
+
title: mention.id,
|
|
115
|
+
isNonInteractive: true,
|
|
116
|
+
render: function render(_ref5) {
|
|
117
|
+
var isSelected = _ref5.isSelected,
|
|
118
|
+
onClick = _ref5.onClick;
|
|
119
|
+
return /*#__PURE__*/React.createElement(MentionItemWithProfileCard, {
|
|
120
|
+
mention: mention,
|
|
121
|
+
selected: isSelected,
|
|
122
|
+
onSelection: onClick,
|
|
123
|
+
height: itemHeight,
|
|
124
|
+
profilecardProvider: profilecardProvider
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
getCustomComponentHeight: function getCustomComponentHeight() {
|
|
128
|
+
return itemHeight;
|
|
129
|
+
},
|
|
130
|
+
mention: mention
|
|
131
|
+
};
|
|
132
|
+
}
|
|
112
133
|
return {
|
|
113
134
|
title: mention.id,
|
|
114
|
-
render: function render(
|
|
115
|
-
var isSelected =
|
|
116
|
-
onClick =
|
|
117
|
-
onHover =
|
|
135
|
+
render: function render(_ref6) {
|
|
136
|
+
var isSelected = _ref6.isSelected,
|
|
137
|
+
onClick = _ref6.onClick,
|
|
138
|
+
onHover = _ref6.onHover;
|
|
118
139
|
return expVal('platform_editor_agent_mentions', 'isEnabled', false) && fg('platform_editor_mention_typeahead_profilecard') ? /*#__PURE__*/React.createElement(MentionItemWithProfileCard, {
|
|
119
140
|
mention: mention,
|
|
120
141
|
selected: isSelected,
|
|
@@ -168,12 +189,12 @@ export function memoize(fn
|
|
|
168
189
|
};
|
|
169
190
|
}
|
|
170
191
|
var buildAndSendElementsTypeAheadAnalytics = function buildAndSendElementsTypeAheadAnalytics(fireEvent) {
|
|
171
|
-
return function (
|
|
172
|
-
var query =
|
|
173
|
-
mentions =
|
|
174
|
-
stats =
|
|
175
|
-
mentionTypeaheadSessionId =
|
|
176
|
-
agentAnalytics =
|
|
192
|
+
return function (_ref7) {
|
|
193
|
+
var query = _ref7.query,
|
|
194
|
+
mentions = _ref7.mentions,
|
|
195
|
+
stats = _ref7.stats,
|
|
196
|
+
mentionTypeaheadSessionId = _ref7.mentionTypeaheadSessionId,
|
|
197
|
+
agentAnalytics = _ref7.agentAnalytics;
|
|
177
198
|
var duration = 0;
|
|
178
199
|
var userOrTeamIds = null;
|
|
179
200
|
var teams = null;
|
|
@@ -275,19 +296,19 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
275
296
|
* `createTypeAheadConfig` and intentionally mutated here as a
|
|
276
297
|
* side-effect — preserves the existing single-shot semantics.
|
|
277
298
|
*/
|
|
278
|
-
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(
|
|
279
|
-
var fireEvent =
|
|
280
|
-
getFirstQueryWithoutResults =
|
|
281
|
-
setFirstQueryWithoutResults =
|
|
282
|
-
toItem =
|
|
283
|
-
enableAgentSectioning =
|
|
284
|
-
return function (
|
|
285
|
-
var mentions =
|
|
286
|
-
query =
|
|
287
|
-
stats =
|
|
288
|
-
mentionProvider =
|
|
289
|
-
contextIdentifierProvider =
|
|
290
|
-
sessionId =
|
|
299
|
+
var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToTypeAheadItems(_ref8) {
|
|
300
|
+
var fireEvent = _ref8.fireEvent,
|
|
301
|
+
getFirstQueryWithoutResults = _ref8.getFirstQueryWithoutResults,
|
|
302
|
+
setFirstQueryWithoutResults = _ref8.setFirstQueryWithoutResults,
|
|
303
|
+
toItem = _ref8.toItem,
|
|
304
|
+
enableAgentSectioning = _ref8.enableAgentSectioning;
|
|
305
|
+
return function (_ref9) {
|
|
306
|
+
var mentions = _ref9.mentions,
|
|
307
|
+
query = _ref9.query,
|
|
308
|
+
stats = _ref9.stats,
|
|
309
|
+
mentionProvider = _ref9.mentionProvider,
|
|
310
|
+
contextIdentifierProvider = _ref9.contextIdentifierProvider,
|
|
311
|
+
sessionId = _ref9.sessionId;
|
|
291
312
|
var displayMentions = shouldApplyMentionSearchOrder(query) ? orderMentionsForDisplay(mentions) : mentions;
|
|
292
313
|
var mentionItems = displayMentions.map(function (mention) {
|
|
293
314
|
return toItem(mention);
|
|
@@ -335,18 +356,18 @@ var makeTransformMentionsToTypeAheadItems = function makeTransformMentionsToType
|
|
|
335
356
|
})(mentionItems);
|
|
336
357
|
};
|
|
337
358
|
};
|
|
338
|
-
export var createTypeAheadConfig = function createTypeAheadConfig(
|
|
339
|
-
var sanitizePrivateContent =
|
|
340
|
-
mentionInsertDisplayName =
|
|
341
|
-
fireEvent =
|
|
342
|
-
HighlightComponent =
|
|
343
|
-
api =
|
|
344
|
-
handleMentionsChanged =
|
|
345
|
-
|
|
346
|
-
enableAgentSectioning =
|
|
347
|
-
|
|
348
|
-
showAgentMentionsLabsLozenge =
|
|
349
|
-
profilecardProvider =
|
|
359
|
+
export var createTypeAheadConfig = function createTypeAheadConfig(_ref0) {
|
|
360
|
+
var sanitizePrivateContent = _ref0.sanitizePrivateContent,
|
|
361
|
+
mentionInsertDisplayName = _ref0.mentionInsertDisplayName,
|
|
362
|
+
fireEvent = _ref0.fireEvent,
|
|
363
|
+
HighlightComponent = _ref0.HighlightComponent,
|
|
364
|
+
api = _ref0.api,
|
|
365
|
+
handleMentionsChanged = _ref0.handleMentionsChanged,
|
|
366
|
+
_ref0$enableAgentSect = _ref0.enableAgentSectioning,
|
|
367
|
+
enableAgentSectioning = _ref0$enableAgentSect === void 0 ? false : _ref0$enableAgentSect,
|
|
368
|
+
_ref0$showAgentMentio = _ref0.showAgentMentionsLabsLozenge,
|
|
369
|
+
showAgentMentionsLabsLozenge = _ref0$showAgentMentio === void 0 ? false : _ref0$showAgentMentio,
|
|
370
|
+
profilecardProvider = _ref0.profilecardProvider;
|
|
350
371
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
351
372
|
var sessionId = uuid();
|
|
352
373
|
var firstQueryWithoutResults = null;
|
|
@@ -379,18 +400,18 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
379
400
|
}
|
|
380
401
|
return null;
|
|
381
402
|
},
|
|
382
|
-
getItems: function getItems(
|
|
403
|
+
getItems: function getItems(_ref1) {
|
|
383
404
|
var _api$contextIdentifie, _api$contextIdentifie2;
|
|
384
|
-
var query =
|
|
385
|
-
editorState =
|
|
405
|
+
var query = _ref1.query,
|
|
406
|
+
editorState = _ref1.editorState;
|
|
386
407
|
lastTypeAheadQuery = query || '';
|
|
387
408
|
var pluginState = getMentionPluginState(editorState);
|
|
388
409
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
389
410
|
return Promise.resolve([]);
|
|
390
411
|
}
|
|
391
412
|
var mentionProvider = pluginState.mentionProvider;
|
|
392
|
-
var
|
|
393
|
-
contextIdentifierProvider =
|
|
413
|
+
var _ref10 = (_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 : {},
|
|
414
|
+
contextIdentifierProvider = _ref10.contextIdentifierProvider;
|
|
394
415
|
return new Promise(function (resolve, reject) {
|
|
395
416
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
396
417
|
var key = "loadingMentionsForTypeAhead_".concat(uuid());
|
|
@@ -425,8 +446,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
425
446
|
}));
|
|
426
447
|
});
|
|
427
448
|
},
|
|
428
|
-
getSections: function getSections(
|
|
429
|
-
var intl =
|
|
449
|
+
getSections: function getSections(_ref11) {
|
|
450
|
+
var intl = _ref11.intl;
|
|
430
451
|
if (!enableAgentSectioning) {
|
|
431
452
|
return [];
|
|
432
453
|
}
|
|
@@ -470,12 +491,12 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
470
491
|
firstQueryWithoutResults = null;
|
|
471
492
|
lastTypeAheadQuery = '';
|
|
472
493
|
},
|
|
473
|
-
selectItem: function selectItem(state, item, insert,
|
|
494
|
+
selectItem: function selectItem(state, item, insert, _ref12) {
|
|
474
495
|
var _api$contextIdentifie3, _api$contextIdentifie4;
|
|
475
|
-
var mode =
|
|
476
|
-
stats =
|
|
477
|
-
query =
|
|
478
|
-
sourceListItem =
|
|
496
|
+
var mode = _ref12.mode,
|
|
497
|
+
stats = _ref12.stats,
|
|
498
|
+
query = _ref12.query,
|
|
499
|
+
sourceListItem = _ref12.sourceListItem;
|
|
479
500
|
var schema = state.schema;
|
|
480
501
|
|
|
481
502
|
// Placeholder isn't selectable. Return `false` (not a transaction) so
|
|
@@ -492,8 +513,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
492
513
|
accessLevel = _item$mention.accessLevel,
|
|
493
514
|
userType = _item$mention.userType,
|
|
494
515
|
isXProductUser = _item$mention.isXProductUser;
|
|
495
|
-
var
|
|
496
|
-
contextIdentifierProvider =
|
|
516
|
+
var _ref13 = (_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 : {},
|
|
517
|
+
contextIdentifierProvider = _ref13.contextIdentifierProvider;
|
|
497
518
|
var mentionContext = _objectSpread(_objectSpread({}, contextIdentifierProvider), {}, {
|
|
498
519
|
sessionId: sessionId
|
|
499
520
|
});
|
|
@@ -620,11 +641,11 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
620
641
|
}
|
|
621
642
|
return tr;
|
|
622
643
|
},
|
|
623
|
-
dismiss: function dismiss(
|
|
624
|
-
var editorState =
|
|
625
|
-
query =
|
|
626
|
-
stats =
|
|
627
|
-
wasItemInserted =
|
|
644
|
+
dismiss: function dismiss(_ref14) {
|
|
645
|
+
var editorState = _ref14.editorState,
|
|
646
|
+
query = _ref14.query,
|
|
647
|
+
stats = _ref14.stats,
|
|
648
|
+
wasItemInserted = _ref14.wasItemInserted;
|
|
628
649
|
firstQueryWithoutResults = null;
|
|
629
650
|
var pickerElapsedTime = stats.startedAt ? performance.now() - stats.startedAt : 0;
|
|
630
651
|
if (!wasItemInserted) {
|
|
@@ -668,10 +689,10 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
668
689
|
* so we only attach it when the gate is on — otherwise the proven
|
|
669
690
|
* single-shot `getItems` path continues to drive every consumer.
|
|
670
691
|
*/
|
|
671
|
-
var subscribeToItemsUpdates = function subscribeToItemsUpdates(
|
|
692
|
+
var subscribeToItemsUpdates = function subscribeToItemsUpdates(_ref15) {
|
|
672
693
|
var _api$contextIdentifie5, _api$contextIdentifie6;
|
|
673
|
-
var query =
|
|
674
|
-
editorState =
|
|
694
|
+
var query = _ref15.query,
|
|
695
|
+
editorState = _ref15.editorState;
|
|
675
696
|
lastTypeAheadQuery = query || '';
|
|
676
697
|
var pluginState = getMentionPluginState(editorState);
|
|
677
698
|
if (!(pluginState !== null && pluginState !== void 0 && pluginState.mentionProvider)) {
|
|
@@ -683,8 +704,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
683
704
|
};
|
|
684
705
|
}
|
|
685
706
|
var mentionProvider = pluginState.mentionProvider;
|
|
686
|
-
var
|
|
687
|
-
contextIdentifierProvider =
|
|
707
|
+
var _ref16 = (_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 : {},
|
|
708
|
+
contextIdentifierProvider = _ref16.contextIdentifierProvider;
|
|
688
709
|
|
|
689
710
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
690
711
|
var key = "loadingMentionsForTypeAhead_".concat(uuid());
|
|
@@ -692,6 +713,7 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
692
713
|
var initialReject = null;
|
|
693
714
|
var initialResolved = false;
|
|
694
715
|
var updateCallback = null;
|
|
716
|
+
var pendingUpdate = null;
|
|
695
717
|
var unsubscribed = false;
|
|
696
718
|
var initial = new Promise(function (resolve, reject) {
|
|
697
719
|
initialResolve = resolve;
|
|
@@ -720,6 +742,9 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
720
742
|
var _initialResolve;
|
|
721
743
|
initialResolved = true;
|
|
722
744
|
(_initialResolve = initialResolve) === null || _initialResolve === void 0 || _initialResolve(items);
|
|
745
|
+
} else if (enableAgentSectioning && isExperimentEnabled('platform_editor_mention_search_order') && !updateCallback) {
|
|
746
|
+
// Agent Studio can resolve before the typeahead installs its update subscriber.
|
|
747
|
+
pendingUpdate = items;
|
|
723
748
|
} else {
|
|
724
749
|
var _updateCallback;
|
|
725
750
|
(_updateCallback = updateCallback) === null || _updateCallback === void 0 || _updateCallback(items);
|
|
@@ -747,9 +772,14 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
747
772
|
throw new Error('TypeAhead mention updates support only one subscriber');
|
|
748
773
|
}
|
|
749
774
|
updateCallback = update;
|
|
775
|
+
if (enableAgentSectioning && isExperimentEnabled('platform_editor_mention_search_order') && pendingUpdate) {
|
|
776
|
+
updateCallback(pendingUpdate);
|
|
777
|
+
pendingUpdate = null;
|
|
778
|
+
}
|
|
750
779
|
return function () {
|
|
751
780
|
unsubscribed = true;
|
|
752
781
|
updateCallback = null;
|
|
782
|
+
pendingUpdate = null;
|
|
753
783
|
mentionProvider.unsubscribe(key);
|
|
754
784
|
subscriptionKeys.delete(key);
|
|
755
785
|
// If cleanup runs before the first emission, settle the initial
|
|
@@ -764,6 +794,9 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref9) {
|
|
|
764
794
|
}
|
|
765
795
|
};
|
|
766
796
|
};
|
|
797
|
+
if (enableAgentSectioning && isExperimentEnabled('platform_editor_mention_search_order')) {
|
|
798
|
+
typeAhead.subscribeToItemsUpdates = subscribeToItemsUpdates;
|
|
799
|
+
}
|
|
767
800
|
|
|
768
801
|
// Presence of `subscribeToItemsUpdates` is how the type-ahead hook
|
|
769
802
|
// opts a handler into the multi-emit path, so only expose it when the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "18.2.
|
|
3
|
+
"version": "18.2.4",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@atlaskit/section-message": "^10.2.0",
|
|
48
48
|
"@atlaskit/teams-app-config": "^3.0.0",
|
|
49
49
|
"@atlaskit/theme": "^28.2.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^171.0.0",
|
|
51
51
|
"@atlaskit/tokens": "^16.11.0",
|
|
52
52
|
"@atlaskit/tooltip": "^24.3.0",
|
|
53
53
|
"@atlaskit/user-picker": "^13.12.0",
|
|
@@ -73,43 +73,6 @@
|
|
|
73
73
|
"react-intl": "^7.0.0",
|
|
74
74
|
"wait-for-expect": "^1.2.0"
|
|
75
75
|
},
|
|
76
|
-
"techstack": {
|
|
77
|
-
"@atlassian/frontend": {
|
|
78
|
-
"code-structure": [
|
|
79
|
-
"editor-plugin"
|
|
80
|
-
],
|
|
81
|
-
"import-structure": [
|
|
82
|
-
"atlassian-conventions"
|
|
83
|
-
],
|
|
84
|
-
"circular-dependencies": [
|
|
85
|
-
"file-and-folder-level"
|
|
86
|
-
]
|
|
87
|
-
},
|
|
88
|
-
"@repo/internal": {
|
|
89
|
-
"dom-events": "use-bind-event-listener",
|
|
90
|
-
"design-tokens": [
|
|
91
|
-
"color"
|
|
92
|
-
],
|
|
93
|
-
"theming": [
|
|
94
|
-
"react-context"
|
|
95
|
-
],
|
|
96
|
-
"ui-components": [
|
|
97
|
-
"lite-mode"
|
|
98
|
-
],
|
|
99
|
-
"deprecation": "no-deprecated-imports",
|
|
100
|
-
"styling": [
|
|
101
|
-
"compiled"
|
|
102
|
-
],
|
|
103
|
-
"imports": [
|
|
104
|
-
"import-no-extraneous-disable-for-examples-and-docs"
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"techstackIgnore": {
|
|
109
|
-
"stricter": [
|
|
110
|
-
"@atlassian/tangerine/project-structure"
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
76
|
"platform-feature-flags": {
|
|
114
77
|
"team-mention-inline-smartlink": {
|
|
115
78
|
"type": "boolean"
|