@atlaskit/editor-plugin-type-ahead 2.2.1 → 2.2.3
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 +18 -0
- package/dist/cjs/pm-plugins/decorations.js +3 -1
- package/dist/cjs/ui/ListRow.js +50 -0
- package/dist/cjs/ui/TypeAheadList.js +34 -2
- package/dist/es2019/pm-plugins/decorations.js +3 -1
- package/dist/es2019/ui/ListRow.js +38 -0
- package/dist/es2019/ui/TypeAheadList.js +31 -2
- package/dist/esm/pm-plugins/decorations.js +3 -1
- package/dist/esm/ui/ListRow.js +41 -0
- package/dist/esm/ui/TypeAheadList.js +34 -2
- package/dist/types/ui/ListRow.d.ts +10 -0
- package/dist/types-ts4.5/ui/ListRow.d.ts +10 -0
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-type-ahead
|
|
2
2
|
|
|
3
|
+
## 2.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#132892](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132892)
|
|
8
|
+
[`6db8f28318224`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6db8f28318224) -
|
|
9
|
+
update type ahead locale, add key to ai preview react list child
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.2.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#132152](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132152)
|
|
17
|
+
[`4d3f5ccdc005c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d3f5ccdc005c) -
|
|
18
|
+
[https://product-fabric.atlassian.net/browse/ED-26645](ED-26645) - fix typeahead height issue
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 2.2.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -12,6 +12,7 @@ var _w3cKeyname = require("w3c-keyname");
|
|
|
12
12
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
13
13
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
14
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _colors = require("@atlaskit/theme/colors");
|
|
16
17
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
18
|
var _WrapperTypeAhead = require("../ui/WrapperTypeAhead");
|
|
@@ -93,7 +94,8 @@ var factoryDecorations = exports.factoryDecorations = function factoryDecoration
|
|
|
93
94
|
nodeViewPortalProviderAPI.render(function () {
|
|
94
95
|
var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
|
|
95
96
|
return /*#__PURE__*/_react.default.createElement(_reactIntlNext.IntlProvider, {
|
|
96
|
-
|
|
97
|
+
defaultLocale: (0, _platformFeatureFlags.fg)('platform_editor_update_type_ahead_locale') ? intl.defaultLocale || 'en-US' : undefined,
|
|
98
|
+
locale: intl.locale || ((0, _platformFeatureFlags.fg)('platform_editor_update_type_ahead_locale') ? 'en-US' : 'en'),
|
|
97
99
|
messages: intl.messages,
|
|
98
100
|
formats: intl.formats
|
|
99
101
|
}, /*#__PURE__*/_react.default.createElement(_WrapperTypeAhead.WrapperTypeAhead, {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ListRow = ListRow;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function ListRow(_ref) {
|
|
12
|
+
var children = _ref.children,
|
|
13
|
+
registerChild = _ref.registerChild,
|
|
14
|
+
measure = _ref.measure,
|
|
15
|
+
index = _ref.index,
|
|
16
|
+
style = _ref.style,
|
|
17
|
+
isVisible = _ref.isVisible,
|
|
18
|
+
isScrolling = _ref.isScrolling,
|
|
19
|
+
onMouseMove = _ref.onMouseMove;
|
|
20
|
+
var childElementRef = (0, _react.useRef)(null);
|
|
21
|
+
var setListElementRef = function setListElementRef(element) {
|
|
22
|
+
registerChild === null || registerChild === void 0 || registerChild(element !== null && element !== void 0 ? element : undefined);
|
|
23
|
+
};
|
|
24
|
+
(0, _react.useEffect)(function () {
|
|
25
|
+
// Do not measure if the row is not visible or is scrolling for performance reasons.
|
|
26
|
+
if (!childElementRef.current || !isVisible || isScrolling) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
var observer = new ResizeObserver(function () {
|
|
30
|
+
return measure();
|
|
31
|
+
});
|
|
32
|
+
observer.observe(childElementRef.current);
|
|
33
|
+
return function () {
|
|
34
|
+
return observer.disconnect();
|
|
35
|
+
};
|
|
36
|
+
}, [isScrolling, isVisible, measure]);
|
|
37
|
+
return (
|
|
38
|
+
/*#__PURE__*/
|
|
39
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
40
|
+
_react.default.createElement("div", {
|
|
41
|
+
ref: setListElementRef,
|
|
42
|
+
style: style,
|
|
43
|
+
"data-index": index
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
ref: childElementRef,
|
|
46
|
+
"data-testid": "list-item-height-observed-".concat(index),
|
|
47
|
+
onMouseMove: onMouseMove
|
|
48
|
+
}, children))
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -15,11 +15,13 @@ var _List = require("react-virtualized/dist/commonjs/List");
|
|
|
15
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
16
16
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
17
17
|
var _menu = require("@atlaskit/menu");
|
|
18
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
19
|
var _primitives = require("@atlaskit/primitives");
|
|
19
20
|
var _updateSelectedIndex = require("../pm-plugins/commands/update-selected-index");
|
|
20
21
|
var _constants = require("../pm-plugins/constants");
|
|
21
22
|
var _utils = require("../pm-plugins/utils");
|
|
22
23
|
var _AssistiveText = require("./AssistiveText");
|
|
24
|
+
var _ListRow = require("./ListRow");
|
|
23
25
|
var _TypeAheadListItem = require("./TypeAheadListItem");
|
|
24
26
|
var _ViewMore = require("./ViewMore");
|
|
25
27
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -269,7 +271,9 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
269
271
|
var index = _ref4.index,
|
|
270
272
|
key = _ref4.key,
|
|
271
273
|
style = _ref4.style,
|
|
272
|
-
parent = _ref4.parent
|
|
274
|
+
parent = _ref4.parent,
|
|
275
|
+
isScrolling = _ref4.isScrolling,
|
|
276
|
+
isVisible = _ref4.isVisible;
|
|
273
277
|
var currentItem = items[index];
|
|
274
278
|
return (0, _react2.jsx)(_CellMeasurer.CellMeasurer, {
|
|
275
279
|
key: key,
|
|
@@ -277,7 +281,35 @@ var TypeAheadListComponent = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
|
277
281
|
parent: parent,
|
|
278
282
|
columnIndex: 0,
|
|
279
283
|
rowIndex: index
|
|
280
|
-
}, (0,
|
|
284
|
+
}, (0, _platformFeatureFlags.fg)('platform_editor_typeahead_dynamic_height_fix') ? function (_ref5) {
|
|
285
|
+
var measure = _ref5.measure,
|
|
286
|
+
registerChild = _ref5.registerChild;
|
|
287
|
+
return (0, _react2.jsx)(_ListRow.ListRow, {
|
|
288
|
+
registerChild: registerChild,
|
|
289
|
+
measure: measure,
|
|
290
|
+
index: index
|
|
291
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
292
|
+
,
|
|
293
|
+
style: style,
|
|
294
|
+
isVisible: isVisible,
|
|
295
|
+
isScrolling: isScrolling,
|
|
296
|
+
onMouseMove: function onMouseMove(e) {
|
|
297
|
+
return _onMouseMove(e, index);
|
|
298
|
+
}
|
|
299
|
+
}, (0, _react2.jsx)(_TypeAheadListItem.TypeAheadListItem, {
|
|
300
|
+
key: items[index].title,
|
|
301
|
+
item: currentItem,
|
|
302
|
+
firstOnlineSupportedIndex: firstOnlineSupportedRow,
|
|
303
|
+
itemsLength: itemsLength,
|
|
304
|
+
itemIndex: index,
|
|
305
|
+
selectedIndex: selectedIndex,
|
|
306
|
+
onItemClick: actions.onItemClick,
|
|
307
|
+
ariaLabel: (0, _utils.getTypeAheadListAriaLabels)(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel,
|
|
308
|
+
moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled,
|
|
309
|
+
api: api
|
|
310
|
+
}));
|
|
311
|
+
} : (0, _react2.jsx)("div", {
|
|
312
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
281
313
|
style: style,
|
|
282
314
|
"data-index": index
|
|
283
315
|
}, (0, _react2.jsx)("div", {
|
|
@@ -5,6 +5,7 @@ import { keyName as keyNameNormalized } from 'w3c-keyname';
|
|
|
5
5
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
6
6
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { B400 } from '@atlaskit/theme/colors';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
|
|
@@ -92,7 +93,8 @@ export const factoryDecorations = ({
|
|
|
92
93
|
nodeViewPortalProviderAPI.render(() => {
|
|
93
94
|
var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
|
|
94
95
|
return /*#__PURE__*/React.createElement(IntlProvider, {
|
|
95
|
-
|
|
96
|
+
defaultLocale: fg('platform_editor_update_type_ahead_locale') ? intl.defaultLocale || 'en-US' : undefined,
|
|
97
|
+
locale: intl.locale || (fg('platform_editor_update_type_ahead_locale') ? 'en-US' : 'en'),
|
|
96
98
|
messages: intl.messages,
|
|
97
99
|
formats: intl.formats
|
|
98
100
|
}, /*#__PURE__*/React.createElement(WrapperTypeAhead, {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
export function ListRow({
|
|
3
|
+
children,
|
|
4
|
+
registerChild,
|
|
5
|
+
measure,
|
|
6
|
+
index,
|
|
7
|
+
style,
|
|
8
|
+
isVisible,
|
|
9
|
+
isScrolling,
|
|
10
|
+
onMouseMove
|
|
11
|
+
}) {
|
|
12
|
+
const childElementRef = useRef(null);
|
|
13
|
+
const setListElementRef = element => {
|
|
14
|
+
registerChild === null || registerChild === void 0 ? void 0 : registerChild(element !== null && element !== void 0 ? element : undefined);
|
|
15
|
+
};
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
// Do not measure if the row is not visible or is scrolling for performance reasons.
|
|
18
|
+
if (!childElementRef.current || !isVisible || isScrolling) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const observer = new ResizeObserver(() => measure());
|
|
22
|
+
observer.observe(childElementRef.current);
|
|
23
|
+
return () => observer.disconnect();
|
|
24
|
+
}, [isScrolling, isVisible, measure]);
|
|
25
|
+
return (
|
|
26
|
+
/*#__PURE__*/
|
|
27
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
28
|
+
React.createElement("div", {
|
|
29
|
+
ref: setListElementRef,
|
|
30
|
+
style: style,
|
|
31
|
+
"data-index": index
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
ref: childElementRef,
|
|
34
|
+
"data-testid": `list-item-height-observed-${index}`,
|
|
35
|
+
onMouseMove: onMouseMove
|
|
36
|
+
}, children))
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -13,11 +13,13 @@ import { List } from 'react-virtualized/dist/commonjs/List';
|
|
|
13
13
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
14
14
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
15
15
|
import { MenuGroup } from '@atlaskit/menu';
|
|
16
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
16
17
|
import { Text, Box } from '@atlaskit/primitives';
|
|
17
18
|
import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
|
|
18
19
|
import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../pm-plugins/constants';
|
|
19
20
|
import { getTypeAheadListAriaLabels, moveSelectedIndex } from '../pm-plugins/utils';
|
|
20
21
|
import { AssistiveText } from './AssistiveText';
|
|
22
|
+
import { ListRow } from './ListRow';
|
|
21
23
|
import { TypeAheadListItem } from './TypeAheadListItem';
|
|
22
24
|
import { ViewMore } from './ViewMore';
|
|
23
25
|
const LIST_ITEM_ESTIMATED_HEIGHT = 64;
|
|
@@ -249,7 +251,9 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
249
251
|
index,
|
|
250
252
|
key,
|
|
251
253
|
style,
|
|
252
|
-
parent
|
|
254
|
+
parent,
|
|
255
|
+
isScrolling,
|
|
256
|
+
isVisible
|
|
253
257
|
}) => {
|
|
254
258
|
const currentItem = items[index];
|
|
255
259
|
return jsx(CellMeasurer, {
|
|
@@ -258,7 +262,32 @@ const TypeAheadListComponent = /*#__PURE__*/React.memo(({
|
|
|
258
262
|
parent: parent,
|
|
259
263
|
columnIndex: 0,
|
|
260
264
|
rowIndex: index
|
|
261
|
-
},
|
|
265
|
+
}, fg('platform_editor_typeahead_dynamic_height_fix') ? ({
|
|
266
|
+
measure,
|
|
267
|
+
registerChild
|
|
268
|
+
}) => jsx(ListRow, {
|
|
269
|
+
registerChild: registerChild,
|
|
270
|
+
measure: measure,
|
|
271
|
+
index: index
|
|
272
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
273
|
+
,
|
|
274
|
+
style: style,
|
|
275
|
+
isVisible: isVisible,
|
|
276
|
+
isScrolling: isScrolling,
|
|
277
|
+
onMouseMove: e => onMouseMove(e, index)
|
|
278
|
+
}, jsx(TypeAheadListItem, {
|
|
279
|
+
key: items[index].title,
|
|
280
|
+
item: currentItem,
|
|
281
|
+
firstOnlineSupportedIndex: firstOnlineSupportedRow,
|
|
282
|
+
itemsLength: itemsLength,
|
|
283
|
+
itemIndex: index,
|
|
284
|
+
selectedIndex: selectedIndex,
|
|
285
|
+
onItemClick: actions.onItemClick,
|
|
286
|
+
ariaLabel: getTypeAheadListAriaLabels(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel,
|
|
287
|
+
moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled,
|
|
288
|
+
api: api
|
|
289
|
+
})) : jsx("div", {
|
|
290
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
262
291
|
style: style,
|
|
263
292
|
"data-index": index
|
|
264
293
|
}, jsx("div", {
|
|
@@ -5,6 +5,7 @@ import { keyName as keyNameNormalized } from 'w3c-keyname';
|
|
|
5
5
|
import { redo, undo } from '@atlaskit/editor-prosemirror/history';
|
|
6
6
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
9
|
import { B400 } from '@atlaskit/theme/colors';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { WrapperTypeAhead } from '../ui/WrapperTypeAhead';
|
|
@@ -86,7 +87,8 @@ export var factoryDecorations = function factoryDecorations(_ref) {
|
|
|
86
87
|
nodeViewPortalProviderAPI.render(function () {
|
|
87
88
|
var _popupMountRef$curren, _popupMountRef$curren2, _popupMountRef$curren3;
|
|
88
89
|
return /*#__PURE__*/React.createElement(IntlProvider, {
|
|
89
|
-
|
|
90
|
+
defaultLocale: fg('platform_editor_update_type_ahead_locale') ? intl.defaultLocale || 'en-US' : undefined,
|
|
91
|
+
locale: intl.locale || (fg('platform_editor_update_type_ahead_locale') ? 'en-US' : 'en'),
|
|
90
92
|
messages: intl.messages,
|
|
91
93
|
formats: intl.formats
|
|
92
94
|
}, /*#__PURE__*/React.createElement(WrapperTypeAhead, {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
export function ListRow(_ref) {
|
|
3
|
+
var children = _ref.children,
|
|
4
|
+
registerChild = _ref.registerChild,
|
|
5
|
+
measure = _ref.measure,
|
|
6
|
+
index = _ref.index,
|
|
7
|
+
style = _ref.style,
|
|
8
|
+
isVisible = _ref.isVisible,
|
|
9
|
+
isScrolling = _ref.isScrolling,
|
|
10
|
+
onMouseMove = _ref.onMouseMove;
|
|
11
|
+
var childElementRef = useRef(null);
|
|
12
|
+
var setListElementRef = function setListElementRef(element) {
|
|
13
|
+
registerChild === null || registerChild === void 0 || registerChild(element !== null && element !== void 0 ? element : undefined);
|
|
14
|
+
};
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
// Do not measure if the row is not visible or is scrolling for performance reasons.
|
|
17
|
+
if (!childElementRef.current || !isVisible || isScrolling) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
var observer = new ResizeObserver(function () {
|
|
21
|
+
return measure();
|
|
22
|
+
});
|
|
23
|
+
observer.observe(childElementRef.current);
|
|
24
|
+
return function () {
|
|
25
|
+
return observer.disconnect();
|
|
26
|
+
};
|
|
27
|
+
}, [isScrolling, isVisible, measure]);
|
|
28
|
+
return (
|
|
29
|
+
/*#__PURE__*/
|
|
30
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
31
|
+
React.createElement("div", {
|
|
32
|
+
ref: setListElementRef,
|
|
33
|
+
style: style,
|
|
34
|
+
"data-index": index
|
|
35
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
ref: childElementRef,
|
|
37
|
+
"data-testid": "list-item-height-observed-".concat(index),
|
|
38
|
+
onMouseMove: onMouseMove
|
|
39
|
+
}, children))
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -14,11 +14,13 @@ import { List } from 'react-virtualized/dist/commonjs/List';
|
|
|
14
14
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
15
15
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
16
16
|
import { MenuGroup } from '@atlaskit/menu';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { Text, Box } from '@atlaskit/primitives';
|
|
18
19
|
import { updateSelectedIndex } from '../pm-plugins/commands/update-selected-index';
|
|
19
20
|
import { TYPE_AHEAD_DECORATION_ELEMENT_ID } from '../pm-plugins/constants';
|
|
20
21
|
import { getTypeAheadListAriaLabels, moveSelectedIndex } from '../pm-plugins/utils';
|
|
21
22
|
import { AssistiveText } from './AssistiveText';
|
|
23
|
+
import { ListRow } from './ListRow';
|
|
22
24
|
import { TypeAheadListItem } from './TypeAheadListItem';
|
|
23
25
|
import { ViewMore } from './ViewMore';
|
|
24
26
|
var LIST_ITEM_ESTIMATED_HEIGHT = 64;
|
|
@@ -259,7 +261,9 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
259
261
|
var index = _ref4.index,
|
|
260
262
|
key = _ref4.key,
|
|
261
263
|
style = _ref4.style,
|
|
262
|
-
parent = _ref4.parent
|
|
264
|
+
parent = _ref4.parent,
|
|
265
|
+
isScrolling = _ref4.isScrolling,
|
|
266
|
+
isVisible = _ref4.isVisible;
|
|
263
267
|
var currentItem = items[index];
|
|
264
268
|
return jsx(CellMeasurer, {
|
|
265
269
|
key: key,
|
|
@@ -267,7 +271,35 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
267
271
|
parent: parent,
|
|
268
272
|
columnIndex: 0,
|
|
269
273
|
rowIndex: index
|
|
270
|
-
},
|
|
274
|
+
}, fg('platform_editor_typeahead_dynamic_height_fix') ? function (_ref5) {
|
|
275
|
+
var measure = _ref5.measure,
|
|
276
|
+
registerChild = _ref5.registerChild;
|
|
277
|
+
return jsx(ListRow, {
|
|
278
|
+
registerChild: registerChild,
|
|
279
|
+
measure: measure,
|
|
280
|
+
index: index
|
|
281
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
282
|
+
,
|
|
283
|
+
style: style,
|
|
284
|
+
isVisible: isVisible,
|
|
285
|
+
isScrolling: isScrolling,
|
|
286
|
+
onMouseMove: function onMouseMove(e) {
|
|
287
|
+
return _onMouseMove(e, index);
|
|
288
|
+
}
|
|
289
|
+
}, jsx(TypeAheadListItem, {
|
|
290
|
+
key: items[index].title,
|
|
291
|
+
item: currentItem,
|
|
292
|
+
firstOnlineSupportedIndex: firstOnlineSupportedRow,
|
|
293
|
+
itemsLength: itemsLength,
|
|
294
|
+
itemIndex: index,
|
|
295
|
+
selectedIndex: selectedIndex,
|
|
296
|
+
onItemClick: actions.onItemClick,
|
|
297
|
+
ariaLabel: getTypeAheadListAriaLabels(triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger, intl, currentItem).listItemAriaLabel,
|
|
298
|
+
moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled,
|
|
299
|
+
api: api
|
|
300
|
+
}));
|
|
301
|
+
} : jsx("div", {
|
|
302
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
271
303
|
style: style,
|
|
272
304
|
"data-index": index
|
|
273
305
|
}, jsx("div", {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { type ReactNode, MouseEventHandler } from 'react';
|
|
2
|
+
import { ListRowProps } from 'react-virtualized';
|
|
3
|
+
type Props = {
|
|
4
|
+
measure: () => void;
|
|
5
|
+
registerChild?: (element?: Element) => void;
|
|
6
|
+
onMouseMove: MouseEventHandler<HTMLDivElement>;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
} & Pick<ListRowProps, 'index' | 'style' | 'isScrolling' | 'isVisible'>;
|
|
9
|
+
export declare function ListRow({ children, registerChild, measure, index, style, isVisible, isScrolling, onMouseMove, }: Props): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { type ReactNode, MouseEventHandler } from 'react';
|
|
2
|
+
import { ListRowProps } from 'react-virtualized';
|
|
3
|
+
type Props = {
|
|
4
|
+
measure: () => void;
|
|
5
|
+
registerChild?: (element?: Element) => void;
|
|
6
|
+
onMouseMove: MouseEventHandler<HTMLDivElement>;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
} & Pick<ListRowProps, 'index' | 'style' | 'isScrolling' | 'isVisible'>;
|
|
9
|
+
export declare function ListRow({ children, registerChild, measure, index, style, isVisible, isScrolling, onMouseMove, }: Props): React.JSX.Element;
|
|
10
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
44
44
|
"@atlaskit/heading": "^5.1.0",
|
|
45
|
-
"@atlaskit/icon": "^25.
|
|
46
|
-
"@atlaskit/menu": "^3.
|
|
45
|
+
"@atlaskit/icon": "^25.2.0",
|
|
46
|
+
"@atlaskit/menu": "^3.2.0",
|
|
47
47
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
48
|
"@atlaskit/primitives": "^14.2.0",
|
|
49
49
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
@@ -95,11 +95,17 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
"platform-feature-flags": {
|
|
98
|
+
"platform_editor_update_type_ahead_locale": {
|
|
99
|
+
"type": "boolean"
|
|
100
|
+
},
|
|
98
101
|
"platform_editor_offline_editing_ga": {
|
|
99
102
|
"type": "boolean"
|
|
100
103
|
},
|
|
101
104
|
"platform_editor_legacy_content_macro_typeahead_fix": {
|
|
102
105
|
"type": "boolean"
|
|
106
|
+
},
|
|
107
|
+
"platform_editor_typeahead_dynamic_height_fix": {
|
|
108
|
+
"type": "boolean"
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
}
|