@atlaskit/editor-plugin-type-ahead 13.0.1 → 13.0.2
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 +7 -0
- package/dist/cjs/pm-plugins/commands/update-section-title.js +1 -2
- package/dist/cjs/pm-plugins/reducer.js +0 -7
- package/dist/cjs/ui/TypeAheadList.js +4 -8
- package/dist/cjs/ui/hooks/build-sectioned-result.js +1 -2
- package/dist/es2019/pm-plugins/commands/update-section-title.js +1 -2
- package/dist/es2019/pm-plugins/reducer.js +0 -7
- package/dist/es2019/ui/TypeAheadList.js +4 -8
- package/dist/es2019/ui/hooks/build-sectioned-result.js +1 -2
- package/dist/esm/pm-plugins/commands/update-section-title.js +1 -2
- package/dist/esm/pm-plugins/reducer.js +0 -7
- package/dist/esm/ui/TypeAheadList.js +4 -8
- package/dist/esm/ui/hooks/build-sectioned-result.js +1 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 13.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f8280f6b24eec`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f8280f6b24eec) -
|
|
8
|
+
Allow editor surfaces to control agent mention picker sectioning independently.
|
|
9
|
+
|
|
3
10
|
## 13.0.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.updateSectionTitle = void 0;
|
|
7
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
8
7
|
var _actions = require("../actions");
|
|
9
8
|
var _key = require("../key");
|
|
10
9
|
var updateSectionTitle = exports.updateSectionTitle = function updateSectionTitle(_ref) {
|
|
@@ -12,7 +11,7 @@ var updateSectionTitle = exports.updateSectionTitle = function updateSectionTitl
|
|
|
12
11
|
title = _ref.title,
|
|
13
12
|
sectionTitleDisplay = _ref.sectionTitleDisplay;
|
|
14
13
|
return function (state, dispatch) {
|
|
15
|
-
if (!
|
|
14
|
+
if (!dispatch) {
|
|
16
15
|
return false;
|
|
17
16
|
}
|
|
18
17
|
var tr = state.tr;
|
|
@@ -10,7 +10,6 @@ var _steps = require("@atlaskit/adf-schema/steps");
|
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
12
|
var _insm = require("@atlaskit/insm");
|
|
13
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
14
13
|
var _actions = require("./actions");
|
|
15
14
|
var _key = require("./key");
|
|
16
15
|
var _utils = require("./utils");
|
|
@@ -35,9 +34,6 @@ var shouldForceClose = function shouldForceClose(step) {
|
|
|
35
34
|
var applySectionTitleUpdates = function applySectionTitleUpdates(_ref) {
|
|
36
35
|
var sections = _ref.sections,
|
|
37
36
|
sectionTitleUpdates = _ref.sectionTitleUpdates;
|
|
38
|
-
if (!(0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
39
|
-
return sections;
|
|
40
|
-
}
|
|
41
37
|
var updatedSections = sections.map(function (section) {
|
|
42
38
|
var update = sectionTitleUpdates[section.id];
|
|
43
39
|
if (!update) {
|
|
@@ -177,9 +173,6 @@ var createReducer = exports.createReducer = function createReducer(_ref2) {
|
|
|
177
173
|
selectedIndex: Math.max(selectedIndex >= items.length ? items.length - 1 : selectedIndex, -1)
|
|
178
174
|
});
|
|
179
175
|
} else if (shouldUpdateSectionTitleState) {
|
|
180
|
-
if (!(0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
181
|
-
return currentPluginState;
|
|
182
|
-
}
|
|
183
176
|
var id = params.id,
|
|
184
177
|
update = params.update;
|
|
185
178
|
var sectionTitleUpdates = _objectSpread(_objectSpread({}, currentPluginState.sectionTitleUpdates), {}, (0, _defineProperty2.default)({}, id, _objectSpread(_objectSpread({}, currentPluginState.sectionTitleUpdates[id]), update)));
|
|
@@ -20,7 +20,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
20
20
|
var _menu = require("@atlaskit/menu");
|
|
21
21
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
22
22
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
23
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
24
23
|
var _closeTypeAhead = require("../pm-plugins/commands/close-type-ahead");
|
|
25
24
|
var _updateSelectedIndex = require("../pm-plugins/commands/update-selected-index");
|
|
26
25
|
var _constants = require("../pm-plugins/constants");
|
|
@@ -56,9 +55,6 @@ var shouldRenderSectionTitle = function shouldRenderSectionTitle(_ref) {
|
|
|
56
55
|
var isEmptyQuery = _ref.isEmptyQuery,
|
|
57
56
|
populatedSectionCount = _ref.populatedSectionCount,
|
|
58
57
|
section = _ref.section;
|
|
59
|
-
if (!(0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
60
|
-
return populatedSectionCount > 1;
|
|
61
|
-
}
|
|
62
58
|
if (!isEmptyQuery && ((_section$sectionTitle = section.sectionTitleDisplay) === null || _section$sectionTitle === void 0 ? void 0 : _section$sectionTitle.showWhenQueryPresent) === false) {
|
|
63
59
|
return false;
|
|
64
60
|
}
|
|
@@ -307,9 +303,10 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
307
303
|
}
|
|
308
304
|
});
|
|
309
305
|
}, [items, sections]);
|
|
306
|
+
var hasSections = sections && sections.length > 0;
|
|
310
307
|
(0, _react.useLayoutEffect)(function () {
|
|
311
308
|
// Exclude view more item from the count
|
|
312
|
-
var itemsToRender =
|
|
309
|
+
var itemsToRender = hasSections ? listRows : showMoreOptionsButton ? items.slice(0, -1) : items;
|
|
313
310
|
var height = Math.min(
|
|
314
311
|
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
|
|
315
312
|
itemsToRender.reduce(function (prevValue, currentValue, index) {
|
|
@@ -318,7 +315,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
318
315
|
});
|
|
319
316
|
}, 0), fitHeight);
|
|
320
317
|
setHeight(height);
|
|
321
|
-
}, [listRows, items, cache, fitHeight, showMoreOptionsButton]);
|
|
318
|
+
}, [listRows, items, cache, fitHeight, hasSections, showMoreOptionsButton]);
|
|
322
319
|
(0, _react.useLayoutEffect)(function () {
|
|
323
320
|
if (!listContainerRef.current) {
|
|
324
321
|
return;
|
|
@@ -377,7 +374,6 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
377
374
|
});
|
|
378
375
|
}, [items]);
|
|
379
376
|
var config = triggerHandler === null || triggerHandler === void 0 || (_triggerHandler$getMo = triggerHandler.getMoreOptionsButtonConfig) === null || _triggerHandler$getMo === void 0 ? void 0 : _triggerHandler$getMo.call(triggerHandler, intl);
|
|
380
|
-
var shouldRenderSectionLozenge = (0, _expVal.expVal)('platform_editor_agent_mentions', 'isEnabled', false);
|
|
381
377
|
var handleClick = function handleClick() {
|
|
382
378
|
if (onMoreOptionsClicked) {
|
|
383
379
|
onMoreOptionsClicked();
|
|
@@ -402,7 +398,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
402
398
|
if (!currentRow) {
|
|
403
399
|
return null;
|
|
404
400
|
}
|
|
405
|
-
var sectionLozenge = currentRow.type === 'section'
|
|
401
|
+
var sectionLozenge = currentRow.type === 'section' ? currentRow.section.lozenge : null;
|
|
406
402
|
return (0, _react2.jsx)(_CellMeasurer.CellMeasurer, {
|
|
407
403
|
key: key,
|
|
408
404
|
cache: cache,
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.buildSectionedResult = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
10
9
|
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; } } }; }
|
|
11
10
|
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; } }
|
|
12
11
|
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; }
|
|
@@ -15,7 +14,7 @@ var buildSectionedResult = exports.buildSectionedResult = function buildSectione
|
|
|
15
14
|
var items = _ref.items,
|
|
16
15
|
triggerHandler = _ref.triggerHandler,
|
|
17
16
|
intl = _ref.intl;
|
|
18
|
-
if (!
|
|
17
|
+
if (!intl) {
|
|
19
18
|
return {
|
|
20
19
|
items: items,
|
|
21
20
|
sections: []
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
2
1
|
import { ACTIONS } from '../actions';
|
|
3
2
|
import { pluginKey as typeAheadPluginKey } from '../key';
|
|
4
3
|
export const updateSectionTitle = ({
|
|
@@ -7,7 +6,7 @@ export const updateSectionTitle = ({
|
|
|
7
6
|
sectionTitleDisplay
|
|
8
7
|
}) => {
|
|
9
8
|
return (state, dispatch) => {
|
|
10
|
-
if (!
|
|
9
|
+
if (!dispatch) {
|
|
11
10
|
return false;
|
|
12
11
|
}
|
|
13
12
|
const tr = state.tr;
|
|
@@ -2,7 +2,6 @@ import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema
|
|
|
2
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { insm } from '@atlaskit/insm';
|
|
5
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
6
5
|
import { ACTIONS } from './actions';
|
|
7
6
|
import { pluginKey } from './key';
|
|
8
7
|
import { isTypeAheadHandler } from './utils';
|
|
@@ -26,9 +25,6 @@ const applySectionTitleUpdates = ({
|
|
|
26
25
|
sections,
|
|
27
26
|
sectionTitleUpdates
|
|
28
27
|
}) => {
|
|
29
|
-
if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
30
|
-
return sections;
|
|
31
|
-
}
|
|
32
28
|
const updatedSections = sections.map(section => {
|
|
33
29
|
const update = sectionTitleUpdates[section.id];
|
|
34
30
|
if (!update) {
|
|
@@ -181,9 +177,6 @@ export const createReducer = ({
|
|
|
181
177
|
selectedIndex: Math.max(selectedIndex >= items.length ? items.length - 1 : selectedIndex, -1)
|
|
182
178
|
};
|
|
183
179
|
} else if (shouldUpdateSectionTitleState) {
|
|
184
|
-
if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
185
|
-
return currentPluginState;
|
|
186
|
-
}
|
|
187
180
|
const {
|
|
188
181
|
id,
|
|
189
182
|
update
|
|
@@ -17,7 +17,6 @@ import { AssistiveText } from '@atlaskit/editor-common/ui';
|
|
|
17
17
|
import { MenuGroup } from '@atlaskit/menu';
|
|
18
18
|
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
19
19
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
20
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
21
20
|
import { closeTypeAhead } from '../pm-plugins/commands/close-type-ahead';
|
|
22
21
|
import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
|
|
23
22
|
import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../pm-plugins/constants';
|
|
@@ -46,9 +45,6 @@ const shouldRenderSectionTitle = ({
|
|
|
46
45
|
section
|
|
47
46
|
}) => {
|
|
48
47
|
var _section$sectionTitle;
|
|
49
|
-
if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
50
|
-
return populatedSectionCount > 1;
|
|
51
|
-
}
|
|
52
48
|
if (!isEmptyQuery && ((_section$sectionTitle = section.sectionTitleDisplay) === null || _section$sectionTitle === void 0 ? void 0 : _section$sectionTitle.showWhenQueryPresent) === false) {
|
|
53
49
|
return false;
|
|
54
50
|
}
|
|
@@ -280,9 +276,10 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
280
276
|
}
|
|
281
277
|
});
|
|
282
278
|
}, [items, sections]);
|
|
279
|
+
const hasSections = sections && sections.length > 0;
|
|
283
280
|
useLayoutEffect(() => {
|
|
284
281
|
// Exclude view more item from the count
|
|
285
|
-
const itemsToRender =
|
|
282
|
+
const itemsToRender = hasSections ? listRows : showMoreOptionsButton ? items.slice(0, -1) : items;
|
|
286
283
|
const height = Math.min(
|
|
287
284
|
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
|
|
288
285
|
itemsToRender.reduce((prevValue, currentValue, index) => {
|
|
@@ -291,7 +288,7 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
291
288
|
});
|
|
292
289
|
}, 0), fitHeight);
|
|
293
290
|
setHeight(height);
|
|
294
|
-
}, [listRows, items, cache, fitHeight, showMoreOptionsButton]);
|
|
291
|
+
}, [listRows, items, cache, fitHeight, hasSections, showMoreOptionsButton]);
|
|
295
292
|
useLayoutEffect(() => {
|
|
296
293
|
if (!listContainerRef.current) {
|
|
297
294
|
return;
|
|
@@ -350,7 +347,6 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
350
347
|
return items.findIndex(item => item.isDisabledOffline !== true);
|
|
351
348
|
}, [items]);
|
|
352
349
|
const config = triggerHandler === null || triggerHandler === void 0 ? void 0 : (_triggerHandler$getMo = triggerHandler.getMoreOptionsButtonConfig) === null || _triggerHandler$getMo === void 0 ? void 0 : _triggerHandler$getMo.call(triggerHandler, intl);
|
|
353
|
-
const shouldRenderSectionLozenge = expVal('platform_editor_agent_mentions', 'isEnabled', false);
|
|
354
350
|
const handleClick = () => {
|
|
355
351
|
if (onMoreOptionsClicked) {
|
|
356
352
|
onMoreOptionsClicked();
|
|
@@ -377,7 +373,7 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
377
373
|
if (!currentRow) {
|
|
378
374
|
return null;
|
|
379
375
|
}
|
|
380
|
-
const sectionLozenge = currentRow.type === 'section'
|
|
376
|
+
const sectionLozenge = currentRow.type === 'section' ? currentRow.section.lozenge : null;
|
|
381
377
|
return jsx(CellMeasurer, {
|
|
382
378
|
key: key,
|
|
383
379
|
cache: cache,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
2
1
|
export const buildSectionedResult = ({
|
|
3
2
|
items,
|
|
4
3
|
triggerHandler,
|
|
5
4
|
intl
|
|
6
5
|
}) => {
|
|
7
6
|
var _triggerHandler$getSe;
|
|
8
|
-
if (!
|
|
7
|
+
if (!intl) {
|
|
9
8
|
return {
|
|
10
9
|
items,
|
|
11
10
|
sections: []
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
2
1
|
import { ACTIONS } from '../actions';
|
|
3
2
|
import { pluginKey as typeAheadPluginKey } from '../key';
|
|
4
3
|
export var updateSectionTitle = function updateSectionTitle(_ref) {
|
|
@@ -6,7 +5,7 @@ export var updateSectionTitle = function updateSectionTitle(_ref) {
|
|
|
6
5
|
title = _ref.title,
|
|
7
6
|
sectionTitleDisplay = _ref.sectionTitleDisplay;
|
|
8
7
|
return function (state, dispatch) {
|
|
9
|
-
if (!
|
|
8
|
+
if (!dispatch) {
|
|
10
9
|
return false;
|
|
11
10
|
}
|
|
12
11
|
var tr = state.tr;
|
|
@@ -5,7 +5,6 @@ import { InsertTypeAheadStages, InsertTypeAheadStep } from '@atlaskit/adf-schema
|
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { insm } from '@atlaskit/insm';
|
|
8
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
9
8
|
import { ACTIONS } from './actions';
|
|
10
9
|
import { pluginKey } from './key';
|
|
11
10
|
import { isTypeAheadHandler } from './utils';
|
|
@@ -28,9 +27,6 @@ var shouldForceClose = function shouldForceClose(step) {
|
|
|
28
27
|
var applySectionTitleUpdates = function applySectionTitleUpdates(_ref) {
|
|
29
28
|
var sections = _ref.sections,
|
|
30
29
|
sectionTitleUpdates = _ref.sectionTitleUpdates;
|
|
31
|
-
if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
32
|
-
return sections;
|
|
33
|
-
}
|
|
34
30
|
var updatedSections = sections.map(function (section) {
|
|
35
31
|
var update = sectionTitleUpdates[section.id];
|
|
36
32
|
if (!update) {
|
|
@@ -170,9 +166,6 @@ export var createReducer = function createReducer(_ref2) {
|
|
|
170
166
|
selectedIndex: Math.max(selectedIndex >= items.length ? items.length - 1 : selectedIndex, -1)
|
|
171
167
|
});
|
|
172
168
|
} else if (shouldUpdateSectionTitleState) {
|
|
173
|
-
if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
174
|
-
return currentPluginState;
|
|
175
|
-
}
|
|
176
169
|
var id = params.id,
|
|
177
170
|
update = params.update;
|
|
178
171
|
var sectionTitleUpdates = _objectSpread(_objectSpread({}, currentPluginState.sectionTitleUpdates), {}, _defineProperty({}, id, _objectSpread(_objectSpread({}, currentPluginState.sectionTitleUpdates[id]), update)));
|
|
@@ -19,7 +19,6 @@ import { AssistiveText } from '@atlaskit/editor-common/ui';
|
|
|
19
19
|
import { MenuGroup } from '@atlaskit/menu';
|
|
20
20
|
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
21
21
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
22
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
23
22
|
import { closeTypeAhead } from '../pm-plugins/commands/close-type-ahead';
|
|
24
23
|
import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
|
|
25
24
|
import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../pm-plugins/constants';
|
|
@@ -47,9 +46,6 @@ var shouldRenderSectionTitle = function shouldRenderSectionTitle(_ref) {
|
|
|
47
46
|
var isEmptyQuery = _ref.isEmptyQuery,
|
|
48
47
|
populatedSectionCount = _ref.populatedSectionCount,
|
|
49
48
|
section = _ref.section;
|
|
50
|
-
if (!expVal('platform_editor_agent_mentions', 'isEnabled', false)) {
|
|
51
|
-
return populatedSectionCount > 1;
|
|
52
|
-
}
|
|
53
49
|
if (!isEmptyQuery && ((_section$sectionTitle = section.sectionTitleDisplay) === null || _section$sectionTitle === void 0 ? void 0 : _section$sectionTitle.showWhenQueryPresent) === false) {
|
|
54
50
|
return false;
|
|
55
51
|
}
|
|
@@ -298,9 +294,10 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
298
294
|
}
|
|
299
295
|
});
|
|
300
296
|
}, [items, sections]);
|
|
297
|
+
var hasSections = sections && sections.length > 0;
|
|
301
298
|
useLayoutEffect(function () {
|
|
302
299
|
// Exclude view more item from the count
|
|
303
|
-
var itemsToRender =
|
|
300
|
+
var itemsToRender = hasSections ? listRows : showMoreOptionsButton ? items.slice(0, -1) : items;
|
|
304
301
|
var height = Math.min(
|
|
305
302
|
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- Ignored via go/ees017 (to be fixed)
|
|
306
303
|
itemsToRender.reduce(function (prevValue, currentValue, index) {
|
|
@@ -309,7 +306,7 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
309
306
|
});
|
|
310
307
|
}, 0), fitHeight);
|
|
311
308
|
setHeight(height);
|
|
312
|
-
}, [listRows, items, cache, fitHeight, showMoreOptionsButton]);
|
|
309
|
+
}, [listRows, items, cache, fitHeight, hasSections, showMoreOptionsButton]);
|
|
313
310
|
useLayoutEffect(function () {
|
|
314
311
|
if (!listContainerRef.current) {
|
|
315
312
|
return;
|
|
@@ -368,7 +365,6 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
368
365
|
});
|
|
369
366
|
}, [items]);
|
|
370
367
|
var config = triggerHandler === null || triggerHandler === void 0 || (_triggerHandler$getMo = triggerHandler.getMoreOptionsButtonConfig) === null || _triggerHandler$getMo === void 0 ? void 0 : _triggerHandler$getMo.call(triggerHandler, intl);
|
|
371
|
-
var shouldRenderSectionLozenge = expVal('platform_editor_agent_mentions', 'isEnabled', false);
|
|
372
368
|
var handleClick = function handleClick() {
|
|
373
369
|
if (onMoreOptionsClicked) {
|
|
374
370
|
onMoreOptionsClicked();
|
|
@@ -393,7 +389,7 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
393
389
|
if (!currentRow) {
|
|
394
390
|
return null;
|
|
395
391
|
}
|
|
396
|
-
var sectionLozenge = currentRow.type === 'section'
|
|
392
|
+
var sectionLozenge = currentRow.type === 'section' ? currentRow.section.lozenge : null;
|
|
397
393
|
return jsx(CellMeasurer, {
|
|
398
394
|
key: key,
|
|
399
395
|
cache: cache,
|
|
@@ -2,13 +2,12 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
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; } } }; }
|
|
3
3
|
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; } }
|
|
4
4
|
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; }
|
|
5
|
-
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
6
5
|
export var buildSectionedResult = function buildSectionedResult(_ref) {
|
|
7
6
|
var _triggerHandler$getSe;
|
|
8
7
|
var items = _ref.items,
|
|
9
8
|
triggerHandler = _ref.triggerHandler,
|
|
10
9
|
intl = _ref.intl;
|
|
11
|
-
if (!
|
|
10
|
+
if (!intl) {
|
|
12
11
|
return {
|
|
13
12
|
items: items,
|
|
14
13
|
sections: []
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.2",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/primitives": "^20.5.0",
|
|
37
37
|
"@atlaskit/prosemirror-history": "^1.0.0",
|
|
38
38
|
"@atlaskit/prosemirror-input-rules": "^4.0.0",
|
|
39
|
-
"@atlaskit/tmp-editor-statsig": "^124.
|
|
39
|
+
"@atlaskit/tmp-editor-statsig": "^124.1.0",
|
|
40
40
|
"@atlaskit/tokens": "^15.5.0",
|
|
41
41
|
"@atlaskit/visually-hidden": "^4.1.0",
|
|
42
42
|
"@babel/runtime": "^7.0.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"w3c-keyname": "^2.1.8"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@atlaskit/editor-common": "^116.
|
|
51
|
+
"@atlaskit/editor-common": "^116.25.0",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
53
|
"react-dom": "^18.2.0",
|
|
54
54
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|