@atlaskit/editor-plugin-type-ahead 25.0.6 → 26.0.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 +14 -0
- package/dist/cjs/ui/TypeAheadList.js +2 -8
- package/dist/cjs/ui/TypeAheadMenu.js +1 -9
- package/dist/cjs/ui/TypeAheadPopup.js +0 -2
- package/dist/cjs/ui/hooks/use-load-items.js +3 -9
- package/dist/es2019/ui/TypeAheadList.js +2 -8
- package/dist/es2019/ui/TypeAheadMenu.js +1 -9
- package/dist/es2019/ui/TypeAheadPopup.js +0 -2
- package/dist/es2019/ui/hooks/use-load-items.js +3 -9
- package/dist/esm/ui/TypeAheadList.js +2 -8
- package/dist/esm/ui/TypeAheadMenu.js +1 -9
- package/dist/esm/ui/TypeAheadPopup.js +0 -2
- package/dist/esm/ui/hooks/use-load-items.js +3 -9
- package/dist/types/ui/TypeAheadList.d.ts +0 -2
- package/dist/types/ui/TypeAheadPopup.d.ts +0 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 26.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1cb97ba88fb58`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1cb97ba88fb58) -
|
|
8
|
+
Clean up experiment `platform_editor_insert_menu_ai` (keep control).
|
|
9
|
+
|
|
10
|
+
Breaking changes (`@atlaskit/editor-common`): removed `getEmptyItem` from `TypeAheadHandler`, and
|
|
11
|
+
removed the unused messages `typeAheadListMessages.emptySearchResultsSuggestionNew`,
|
|
12
|
+
`typeAheadListMessages.emptySearchResultsSuggestionAskRovoOnly` and
|
|
13
|
+
`toolbarInsertBlockMessages.askRovo`.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 25.0.6
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -18,7 +18,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
18
18
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
19
19
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
20
20
|
var _menuGroup = _interopRequireDefault(require("@atlaskit/menu/menu-group"));
|
|
21
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
22
21
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
23
22
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
24
23
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
@@ -127,7 +126,6 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
127
126
|
var _itemRowIndexByItemIn, _triggerHandler$getMo, _decorationElement$qu2;
|
|
128
127
|
var items = _ref4.items,
|
|
129
128
|
sections = _ref4.sections,
|
|
130
|
-
emptyItem = _ref4.emptyItem,
|
|
131
129
|
selectedIndex = _ref4.selectedIndex,
|
|
132
130
|
_ref4$isEmptyQuery = _ref4.isEmptyQuery,
|
|
133
131
|
isEmptyQuery = _ref4$isEmptyQuery === void 0 ? true : _ref4$isEmptyQuery,
|
|
@@ -154,7 +152,6 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
154
152
|
|
|
155
153
|
// Exclude view more item from the count
|
|
156
154
|
var itemsLength = showMoreOptionsButton ? Math.max(items.length - 1, 0) : items.length;
|
|
157
|
-
var isEmptyStateActive = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_insert_menu_ai') && !!emptyItem && itemsLength === 1 && items[0] === emptyItem;
|
|
158
155
|
var estimatedHeight = itemsLength * LIST_ITEM_ESTIMATED_HEIGHT;
|
|
159
156
|
var _useState = (0, _react.useState)(Math.min(estimatedHeight, fitHeight)),
|
|
160
157
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -494,10 +491,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
494
491
|
}, intl.formatMessage(_typeAhead.typeAheadListMessages.emptySearchResults)), (0, _react2.jsx)(_compiled.Text, {
|
|
495
492
|
align: "center",
|
|
496
493
|
as: "p"
|
|
497
|
-
}, intl.formatMessage(
|
|
498
|
-
askRovoName: (0, _react2.jsx)(_compiled.Text, {
|
|
499
|
-
weight: "medium"
|
|
500
|
-
}, intl.formatMessage(_messages.toolbarInsertBlockMessages.askRovo)),
|
|
494
|
+
}, intl.formatMessage(_typeAhead.typeAheadListMessages.emptySearchResultsSuggestion, {
|
|
501
495
|
buttonName: (0, _react2.jsx)(_compiled.Text, {
|
|
502
496
|
weight: "medium"
|
|
503
497
|
}, intl.formatMessage(_messages.toolbarInsertBlockMessages.viewMore))
|
|
@@ -538,7 +532,7 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
|
538
532
|
}, (0, _react2.jsx)("div", {
|
|
539
533
|
id: menuGroupId,
|
|
540
534
|
ref: listContainerRef
|
|
541
|
-
},
|
|
535
|
+
}, !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && (0, _react2.jsx)(_MoreOptions.MoreOptions, {
|
|
542
536
|
title: config.title,
|
|
543
537
|
ariaLabel: config.ariaLabel,
|
|
544
538
|
onClick: handleClick,
|
|
@@ -8,7 +8,6 @@ exports.TypeAheadMenu = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
11
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
12
11
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
13
12
|
var _updateSelectedIndex = require("../pm-plugins/commands/update-selected-index");
|
|
14
13
|
var _useItemInsert3 = require("./hooks/use-item-insert");
|
|
@@ -88,13 +87,7 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
|
|
|
88
87
|
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
89
88
|
showMoreOptionsButton = !!(triggerHandler !== null && triggerHandler !== void 0 && triggerHandler.getMoreOptionsButtonConfig);
|
|
90
89
|
}
|
|
91
|
-
|
|
92
|
-
var _triggerHandler$getEm;
|
|
93
|
-
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_insert_menu_ai') ? triggerHandler === null || triggerHandler === void 0 || (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
|
|
94
|
-
editorState: editorView.state
|
|
95
|
-
}) : undefined;
|
|
96
|
-
}, [triggerHandler, editorView.state]);
|
|
97
|
-
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo && !emptyItem) {
|
|
90
|
+
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo) {
|
|
98
91
|
return null;
|
|
99
92
|
}
|
|
100
93
|
return /*#__PURE__*/_react.default.createElement(_TypeAheadPopup.TypeAheadPopup, {
|
|
@@ -106,7 +99,6 @@ var TypeAheadMenu = exports.TypeAheadMenu = /*#__PURE__*/_react.default.memo(fun
|
|
|
106
99
|
triggerHandler: triggerHandler,
|
|
107
100
|
items: items,
|
|
108
101
|
sections: sections,
|
|
109
|
-
emptyItem: emptyItem,
|
|
110
102
|
errorInfo: errorInfo,
|
|
111
103
|
selectedIndex: selectedIndex,
|
|
112
104
|
setSelectedItem: setSelectedItem,
|
|
@@ -75,7 +75,6 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
75
75
|
items = props.items,
|
|
76
76
|
_props$sections = props.sections,
|
|
77
77
|
sections = _props$sections === void 0 ? [] : _props$sections,
|
|
78
|
-
emptyItem = props.emptyItem,
|
|
79
78
|
errorInfo = props.errorInfo,
|
|
80
79
|
selectedIndex = props.selectedIndex,
|
|
81
80
|
onItemInsert = props.onItemInsert,
|
|
@@ -349,7 +348,6 @@ var TypeAheadPopup = exports.TypeAheadPopup = /*#__PURE__*/_react.default.memo(f
|
|
|
349
348
|
items: items,
|
|
350
349
|
isEmptyQuery: isEmptyQuery,
|
|
351
350
|
sections: sections,
|
|
352
|
-
emptyItem: emptyItem,
|
|
353
351
|
selectedIndex: selectedIndex
|
|
354
352
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
355
353
|
,
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useLoadItems = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
11
10
|
var _clearListError = require("../../pm-plugins/commands/clear-list-error");
|
|
12
11
|
var _updateListError = require("../../pm-plugins/commands/update-list-error");
|
|
13
12
|
var _updateListItems = require("../../pm-plugins/commands/update-list-items");
|
|
@@ -48,19 +47,14 @@ var useLoadItems = exports.useLoadItems = function useLoadItems(triggerHandler,
|
|
|
48
47
|
* Promise path and the opt-in multi-emit `subscribeToItemsUpdates`
|
|
49
48
|
* path. Renders the dropdown with whatever items it is given.
|
|
50
49
|
*
|
|
51
|
-
* Both paths share the
|
|
52
|
-
*
|
|
50
|
+
* Both paths share the section-building and "View more"
|
|
51
|
+
* placeholder logic — extracting this helper
|
|
53
52
|
* avoids any chance the two paths drift in subtle rendering
|
|
54
53
|
* behaviour.
|
|
55
54
|
*/
|
|
56
55
|
var renderResult = function renderResult(result) {
|
|
57
|
-
var _triggerHandler$getEm;
|
|
58
|
-
var emptyItem = result.length === 0 && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_insert_menu_ai') ? (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
|
|
59
|
-
editorState: editorView.state
|
|
60
|
-
}) : undefined;
|
|
61
|
-
var rawList = result.length > 0 ? result : emptyItem ? [emptyItem] : EMPTY_LIST_ITEM;
|
|
62
56
|
var _buildSectionedResult = (0, _buildSectionedResult2.buildSectionedResult)({
|
|
63
|
-
items:
|
|
57
|
+
items: result.length > 0 ? result : EMPTY_LIST_ITEM,
|
|
64
58
|
triggerHandler: triggerHandler,
|
|
65
59
|
intl: intl !== null && intl !== void 0 ? intl : null
|
|
66
60
|
}),
|
|
@@ -15,7 +15,6 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
15
15
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
16
16
|
import { AssistiveText } from '@atlaskit/editor-common/ui';
|
|
17
17
|
import MenuGroup from '@atlaskit/menu/menu-group';
|
|
18
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
19
18
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
20
19
|
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
21
20
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -112,7 +111,6 @@ const TypeaheadAssistiveTextPureComponent = /*#__PURE__*/React.memo(({
|
|
|
112
111
|
const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
113
112
|
items,
|
|
114
113
|
sections,
|
|
115
|
-
emptyItem,
|
|
116
114
|
selectedIndex,
|
|
117
115
|
isEmptyQuery = true,
|
|
118
116
|
editorView,
|
|
@@ -140,7 +138,6 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
140
138
|
|
|
141
139
|
// Exclude view more item from the count
|
|
142
140
|
const itemsLength = showMoreOptionsButton ? Math.max(items.length - 1, 0) : items.length;
|
|
143
|
-
const isEmptyStateActive = isExperimentEnabled('platform_editor_insert_menu_ai') && !!emptyItem && itemsLength === 1 && items[0] === emptyItem;
|
|
144
141
|
const estimatedHeight = itemsLength * LIST_ITEM_ESTIMATED_HEIGHT;
|
|
145
142
|
const [height, setHeight] = useState(Math.min(estimatedHeight, fitHeight));
|
|
146
143
|
const [cache, setCache] = useState(new CellMeasurerCache({
|
|
@@ -466,10 +463,7 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
466
463
|
}, intl.formatMessage(typeAheadListMessages.emptySearchResults)), jsx(Text, {
|
|
467
464
|
align: "center",
|
|
468
465
|
as: "p"
|
|
469
|
-
}, intl.formatMessage(
|
|
470
|
-
askRovoName: jsx(Text, {
|
|
471
|
-
weight: "medium"
|
|
472
|
-
}, intl.formatMessage(messages.askRovo)),
|
|
466
|
+
}, intl.formatMessage(typeAheadListMessages.emptySearchResultsSuggestion, {
|
|
473
467
|
buttonName: jsx(Text, {
|
|
474
468
|
weight: "medium"
|
|
475
469
|
}, intl.formatMessage(messages.viewMore))
|
|
@@ -510,7 +504,7 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
510
504
|
}, jsx("div", {
|
|
511
505
|
id: menuGroupId,
|
|
512
506
|
ref: listContainerRef
|
|
513
|
-
},
|
|
507
|
+
}, !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && jsx(MoreOptions, {
|
|
514
508
|
title: config.title,
|
|
515
509
|
ariaLabel: config.ariaLabel,
|
|
516
510
|
onClick: handleClick,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
3
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
5
4
|
import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
|
|
6
5
|
import { useItemInsert } from './hooks/use-item-insert';
|
|
@@ -78,13 +77,7 @@ export const TypeAheadMenu = /*#__PURE__*/React.memo(({
|
|
|
78
77
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
79
78
|
showMoreOptionsButton = !!(triggerHandler !== null && triggerHandler !== void 0 && triggerHandler.getMoreOptionsButtonConfig);
|
|
80
79
|
}
|
|
81
|
-
|
|
82
|
-
var _triggerHandler$getEm;
|
|
83
|
-
return isExperimentEnabled('platform_editor_insert_menu_ai') ? triggerHandler === null || triggerHandler === void 0 ? void 0 : (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
|
|
84
|
-
editorState: editorView.state
|
|
85
|
-
}) : undefined;
|
|
86
|
-
}, [triggerHandler, editorView.state]);
|
|
87
|
-
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo && !emptyItem) {
|
|
80
|
+
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo) {
|
|
88
81
|
return null;
|
|
89
82
|
}
|
|
90
83
|
return /*#__PURE__*/React.createElement(TypeAheadPopup, {
|
|
@@ -96,7 +89,6 @@ export const TypeAheadMenu = /*#__PURE__*/React.memo(({
|
|
|
96
89
|
triggerHandler: triggerHandler,
|
|
97
90
|
items: items,
|
|
98
91
|
sections: sections,
|
|
99
|
-
emptyItem: emptyItem,
|
|
100
92
|
errorInfo: errorInfo,
|
|
101
93
|
selectedIndex: selectedIndex,
|
|
102
94
|
setSelectedItem: setSelectedItem,
|
|
@@ -65,7 +65,6 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
65
65
|
popupsScrollableElement,
|
|
66
66
|
items,
|
|
67
67
|
sections = [],
|
|
68
|
-
emptyItem,
|
|
69
68
|
errorInfo,
|
|
70
69
|
selectedIndex,
|
|
71
70
|
onItemInsert,
|
|
@@ -344,7 +343,6 @@ export const TypeAheadPopup = /*#__PURE__*/React.memo(props => {
|
|
|
344
343
|
items: items,
|
|
345
344
|
isEmptyQuery: isEmptyQuery,
|
|
346
345
|
sections: sections,
|
|
347
|
-
emptyItem: emptyItem,
|
|
348
346
|
selectedIndex: selectedIndex
|
|
349
347
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
350
348
|
,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
3
2
|
import { clearListError } from '../../pm-plugins/commands/clear-list-error';
|
|
4
3
|
import { updateListError } from '../../pm-plugins/commands/update-list-error';
|
|
5
4
|
import { updateListItem } from '../../pm-plugins/commands/update-list-items';
|
|
@@ -36,22 +35,17 @@ export const useLoadItems = (triggerHandler, editorView, query, showViewMore, ap
|
|
|
36
35
|
* Promise path and the opt-in multi-emit `subscribeToItemsUpdates`
|
|
37
36
|
* path. Renders the dropdown with whatever items it is given.
|
|
38
37
|
*
|
|
39
|
-
* Both paths share the
|
|
40
|
-
*
|
|
38
|
+
* Both paths share the section-building and "View more"
|
|
39
|
+
* placeholder logic — extracting this helper
|
|
41
40
|
* avoids any chance the two paths drift in subtle rendering
|
|
42
41
|
* behaviour.
|
|
43
42
|
*/
|
|
44
43
|
const renderResult = result => {
|
|
45
|
-
var _triggerHandler$getEm;
|
|
46
|
-
const emptyItem = result.length === 0 && isExperimentEnabled('platform_editor_insert_menu_ai') ? (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
|
|
47
|
-
editorState: editorView.state
|
|
48
|
-
}) : undefined;
|
|
49
|
-
const rawList = result.length > 0 ? result : emptyItem ? [emptyItem] : EMPTY_LIST_ITEM;
|
|
50
44
|
const {
|
|
51
45
|
items: list,
|
|
52
46
|
sections
|
|
53
47
|
} = buildSectionedResult({
|
|
54
|
-
items:
|
|
48
|
+
items: result.length > 0 ? result : EMPTY_LIST_ITEM,
|
|
55
49
|
triggerHandler,
|
|
56
50
|
intl: intl !== null && intl !== void 0 ? intl : null
|
|
57
51
|
});
|
|
@@ -17,7 +17,6 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
17
17
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
18
18
|
import { AssistiveText } from '@atlaskit/editor-common/ui';
|
|
19
19
|
import MenuGroup from '@atlaskit/menu/menu-group';
|
|
20
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
21
20
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
21
|
import { Box, Inline, Text } from '@atlaskit/primitives/compiled';
|
|
23
22
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -118,7 +117,6 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
118
117
|
var _itemRowIndexByItemIn, _triggerHandler$getMo, _decorationElement$qu2;
|
|
119
118
|
var items = _ref4.items,
|
|
120
119
|
sections = _ref4.sections,
|
|
121
|
-
emptyItem = _ref4.emptyItem,
|
|
122
120
|
selectedIndex = _ref4.selectedIndex,
|
|
123
121
|
_ref4$isEmptyQuery = _ref4.isEmptyQuery,
|
|
124
122
|
isEmptyQuery = _ref4$isEmptyQuery === void 0 ? true : _ref4$isEmptyQuery,
|
|
@@ -145,7 +143,6 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
145
143
|
|
|
146
144
|
// Exclude view more item from the count
|
|
147
145
|
var itemsLength = showMoreOptionsButton ? Math.max(items.length - 1, 0) : items.length;
|
|
148
|
-
var isEmptyStateActive = isExperimentEnabled('platform_editor_insert_menu_ai') && !!emptyItem && itemsLength === 1 && items[0] === emptyItem;
|
|
149
146
|
var estimatedHeight = itemsLength * LIST_ITEM_ESTIMATED_HEIGHT;
|
|
150
147
|
var _useState = useState(Math.min(estimatedHeight, fitHeight)),
|
|
151
148
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -485,10 +482,7 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
485
482
|
}, intl.formatMessage(typeAheadListMessages.emptySearchResults)), jsx(Text, {
|
|
486
483
|
align: "center",
|
|
487
484
|
as: "p"
|
|
488
|
-
}, intl.formatMessage(
|
|
489
|
-
askRovoName: jsx(Text, {
|
|
490
|
-
weight: "medium"
|
|
491
|
-
}, intl.formatMessage(messages.askRovo)),
|
|
485
|
+
}, intl.formatMessage(typeAheadListMessages.emptySearchResultsSuggestion, {
|
|
492
486
|
buttonName: jsx(Text, {
|
|
493
487
|
weight: "medium"
|
|
494
488
|
}, intl.formatMessage(messages.viewMore))
|
|
@@ -529,7 +523,7 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
529
523
|
}, jsx("div", {
|
|
530
524
|
id: menuGroupId,
|
|
531
525
|
ref: listContainerRef
|
|
532
|
-
},
|
|
526
|
+
}, !showMoreOptionsButton || itemsLength ? ListContent : EmptyResultView, showMoreOptionsButton && config && jsx(MoreOptions, {
|
|
533
527
|
title: config.title,
|
|
534
528
|
ariaLabel: config.ariaLabel,
|
|
535
529
|
onClick: handleClick,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
4
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
6
5
|
import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
|
|
7
6
|
import { useItemInsert } from './hooks/use-item-insert';
|
|
@@ -81,13 +80,7 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
81
80
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
82
81
|
showMoreOptionsButton = !!(triggerHandler !== null && triggerHandler !== void 0 && triggerHandler.getMoreOptionsButtonConfig);
|
|
83
82
|
}
|
|
84
|
-
|
|
85
|
-
var _triggerHandler$getEm;
|
|
86
|
-
return isExperimentEnabled('platform_editor_insert_menu_ai') ? triggerHandler === null || triggerHandler === void 0 || (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
|
|
87
|
-
editorState: editorView.state
|
|
88
|
-
}) : undefined;
|
|
89
|
-
}, [triggerHandler, editorView.state]);
|
|
90
|
-
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo && !emptyItem) {
|
|
83
|
+
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || !openElementBrowserModal && items.length === 0 && !errorInfo) {
|
|
91
84
|
return null;
|
|
92
85
|
}
|
|
93
86
|
return /*#__PURE__*/React.createElement(TypeAheadPopup, {
|
|
@@ -99,7 +92,6 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
99
92
|
triggerHandler: triggerHandler,
|
|
100
93
|
items: items,
|
|
101
94
|
sections: sections,
|
|
102
|
-
emptyItem: emptyItem,
|
|
103
95
|
errorInfo: errorInfo,
|
|
104
96
|
selectedIndex: selectedIndex,
|
|
105
97
|
setSelectedItem: setSelectedItem,
|
|
@@ -65,7 +65,6 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
65
65
|
items = props.items,
|
|
66
66
|
_props$sections = props.sections,
|
|
67
67
|
sections = _props$sections === void 0 ? [] : _props$sections,
|
|
68
|
-
emptyItem = props.emptyItem,
|
|
69
68
|
errorInfo = props.errorInfo,
|
|
70
69
|
selectedIndex = props.selectedIndex,
|
|
71
70
|
onItemInsert = props.onItemInsert,
|
|
@@ -339,7 +338,6 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
339
338
|
items: items,
|
|
340
339
|
isEmptyQuery: isEmptyQuery,
|
|
341
340
|
sections: sections,
|
|
342
|
-
emptyItem: emptyItem,
|
|
343
341
|
selectedIndex: selectedIndex
|
|
344
342
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
345
343
|
,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
3
|
import { clearListError } from '../../pm-plugins/commands/clear-list-error';
|
|
5
4
|
import { updateListError } from '../../pm-plugins/commands/update-list-error';
|
|
6
5
|
import { updateListItem } from '../../pm-plugins/commands/update-list-items';
|
|
@@ -41,19 +40,14 @@ export var useLoadItems = function useLoadItems(triggerHandler, editorView, quer
|
|
|
41
40
|
* Promise path and the opt-in multi-emit `subscribeToItemsUpdates`
|
|
42
41
|
* path. Renders the dropdown with whatever items it is given.
|
|
43
42
|
*
|
|
44
|
-
* Both paths share the
|
|
45
|
-
*
|
|
43
|
+
* Both paths share the section-building and "View more"
|
|
44
|
+
* placeholder logic — extracting this helper
|
|
46
45
|
* avoids any chance the two paths drift in subtle rendering
|
|
47
46
|
* behaviour.
|
|
48
47
|
*/
|
|
49
48
|
var renderResult = function renderResult(result) {
|
|
50
|
-
var _triggerHandler$getEm;
|
|
51
|
-
var emptyItem = result.length === 0 && isExperimentEnabled('platform_editor_insert_menu_ai') ? (_triggerHandler$getEm = triggerHandler.getEmptyItem) === null || _triggerHandler$getEm === void 0 ? void 0 : _triggerHandler$getEm.call(triggerHandler, {
|
|
52
|
-
editorState: editorView.state
|
|
53
|
-
}) : undefined;
|
|
54
|
-
var rawList = result.length > 0 ? result : emptyItem ? [emptyItem] : EMPTY_LIST_ITEM;
|
|
55
49
|
var _buildSectionedResult = buildSectionedResult({
|
|
56
|
-
items:
|
|
50
|
+
items: result.length > 0 ? result : EMPTY_LIST_ITEM,
|
|
57
51
|
triggerHandler: triggerHandler,
|
|
58
52
|
intl: intl !== null && intl !== void 0 ? intl : null
|
|
59
53
|
}),
|
|
@@ -26,7 +26,6 @@ export declare const TypeAheadList: React.FC<WithIntlProps<{
|
|
|
26
26
|
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
27
27
|
decorationElement: HTMLElement;
|
|
28
28
|
editorView: EditorView;
|
|
29
|
-
emptyItem?: TypeAheadItem;
|
|
30
29
|
fitHeight: number;
|
|
31
30
|
isEmptyQuery?: boolean;
|
|
32
31
|
items: Array<TypeAheadItem>;
|
|
@@ -42,7 +41,6 @@ export declare const TypeAheadList: React.FC<WithIntlProps<{
|
|
|
42
41
|
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
43
42
|
decorationElement: HTMLElement;
|
|
44
43
|
editorView: EditorView;
|
|
45
|
-
emptyItem?: TypeAheadItem;
|
|
46
44
|
fitHeight: number;
|
|
47
45
|
isEmptyQuery?: boolean;
|
|
48
46
|
items: Array<TypeAheadItem>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "26.0.0",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
],
|
|
22
22
|
"atlaskit:src": "src/index.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^57.
|
|
24
|
+
"@atlaskit/adf-schema": "^57.7.0",
|
|
25
25
|
"@atlaskit/css": "^1.1.0",
|
|
26
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
27
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
28
|
-
"@atlaskit/editor-plugin-context-panel": "^
|
|
29
|
-
"@atlaskit/editor-plugin-metrics": "^
|
|
30
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
26
|
+
"@atlaskit/editor-plugin-analytics": "^25.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-connectivity": "^25.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-context-panel": "^27.0.0",
|
|
29
|
+
"@atlaskit/editor-plugin-metrics": "^26.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^19.0.0",
|
|
31
31
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
32
32
|
"@atlaskit/editor-shared-styles": "^4.3.0",
|
|
33
33
|
"@atlaskit/editor-ui-control-model": "^2.10.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"w3c-keyname": "^2.1.8"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@atlaskit/editor-common": "^
|
|
57
|
+
"@atlaskit/editor-common": "^129.0.0",
|
|
58
58
|
"react": "^18.2.0 || ^19.2.0",
|
|
59
59
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
60
60
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|