@atlaskit/editor-plugin-type-ahead 1.10.7 → 1.11.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 +21 -0
- package/dist/cjs/pm-plugins/commands/update-selected-index.js +7 -1
- package/dist/cjs/pm-plugins/decorations.js +6 -3
- package/dist/cjs/pm-plugins/item-is-disabled.js +11 -0
- package/dist/cjs/pm-plugins/main.js +4 -2
- package/dist/cjs/pm-plugins/utils.js +33 -4
- package/dist/cjs/typeAheadPlugin.js +2 -1
- package/dist/cjs/ui/TypeAheadList.js +19 -9
- package/dist/cjs/ui/TypeAheadListItem.js +39 -13
- package/dist/cjs/ui/TypeAheadMenu.js +3 -3
- package/dist/cjs/ui/TypeAheadPopup.js +5 -2
- package/dist/cjs/ui/WrapperTypeAhead.js +18 -7
- package/dist/cjs/ui/hooks/use-item-insert.js +7 -2
- package/dist/es2019/pm-plugins/commands/update-selected-index.js +7 -1
- package/dist/es2019/pm-plugins/decorations.js +6 -3
- package/dist/es2019/pm-plugins/item-is-disabled.js +5 -0
- package/dist/es2019/pm-plugins/main.js +4 -2
- package/dist/es2019/pm-plugins/utils.js +30 -3
- package/dist/es2019/typeAheadPlugin.js +2 -1
- package/dist/es2019/ui/TypeAheadList.js +17 -9
- package/dist/es2019/ui/TypeAheadListItem.js +39 -13
- package/dist/es2019/ui/TypeAheadMenu.js +3 -3
- package/dist/es2019/ui/TypeAheadPopup.js +5 -2
- package/dist/es2019/ui/WrapperTypeAhead.js +17 -8
- package/dist/es2019/ui/hooks/use-item-insert.js +7 -2
- package/dist/esm/pm-plugins/commands/update-selected-index.js +7 -1
- package/dist/esm/pm-plugins/decorations.js +6 -3
- package/dist/esm/pm-plugins/item-is-disabled.js +5 -0
- package/dist/esm/pm-plugins/main.js +4 -2
- package/dist/esm/pm-plugins/utils.js +32 -3
- package/dist/esm/typeAheadPlugin.js +2 -1
- package/dist/esm/ui/TypeAheadList.js +19 -9
- package/dist/esm/ui/TypeAheadListItem.js +38 -13
- package/dist/esm/ui/TypeAheadMenu.js +3 -3
- package/dist/esm/ui/TypeAheadPopup.js +5 -2
- package/dist/esm/ui/WrapperTypeAhead.js +19 -8
- package/dist/esm/ui/hooks/use-item-insert.js +7 -2
- package/dist/types/pm-plugins/commands/update-selected-index.d.ts +3 -2
- package/dist/types/pm-plugins/decorations.d.ts +4 -1
- package/dist/types/pm-plugins/item-is-disabled.d.ts +4 -0
- package/dist/types/pm-plugins/main.d.ts +4 -1
- package/dist/types/pm-plugins/utils.d.ts +6 -1
- package/dist/types/typeAheadPluginType.d.ts +6 -1
- package/dist/types/ui/TypeAheadList.d.ts +4 -0
- package/dist/types/ui/TypeAheadListItem.d.ts +5 -1
- package/dist/types/ui/WrapperTypeAhead.d.ts +4 -1
- package/dist/types/ui/hooks/use-item-insert.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/commands/update-selected-index.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/decorations.d.ts +4 -1
- package/dist/types-ts4.5/pm-plugins/item-is-disabled.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +4 -1
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +6 -1
- package/dist/types-ts4.5/typeAheadPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/TypeAheadList.d.ts +4 -0
- package/dist/types-ts4.5/ui/TypeAheadListItem.d.ts +5 -1
- package/dist/types-ts4.5/ui/WrapperTypeAhead.d.ts +4 -1
- package/dist/types-ts4.5/ui/hooks/use-item-insert.d.ts +3 -1
- package/package.json +6 -5
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
-
// Disabling for ED-21403 fixing accessibility issue.
|
|
4
|
-
/* eslint-disable jsx-a11y/role-supports-aria-props */
|
|
5
3
|
/**
|
|
6
4
|
* @jsxRuntime classic
|
|
7
5
|
* @jsx jsx
|
|
@@ -11,6 +9,7 @@ import React, { useCallback, useLayoutEffect, useMemo } from 'react';
|
|
|
11
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
12
10
|
import { css, jsx } from '@emotion/react';
|
|
13
11
|
import { useIntl } from 'react-intl-next';
|
|
12
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
14
13
|
import { IconFallback } from '@atlaskit/editor-common/quick-insert';
|
|
15
14
|
import { SelectItemMode, typeAheadListMessages } from '@atlaskit/editor-common/type-ahead';
|
|
16
15
|
import { relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
@@ -103,6 +102,9 @@ var selectionFrame = {
|
|
|
103
102
|
|
|
104
103
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- Ignored via go/DSP-18766
|
|
105
104
|
var selectedStyle = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n\tbackground-color: ", ";\n\tbox-shadow: inset 2px 0px 0px ", ";\n"])), "var(--ds-background-neutral-subtle-hovered, ".concat(N30, ")"), "var(--ds-border-focused, ".concat(B400, ")"));
|
|
105
|
+
var disabledStyle = css({
|
|
106
|
+
color: "var(--ds-text-disabled, #091E424F)"
|
|
107
|
+
});
|
|
106
108
|
var FallbackIcon = /*#__PURE__*/React.memo(function (_ref) {
|
|
107
109
|
var label = _ref.label;
|
|
108
110
|
return jsx(IconFallback, null);
|
|
@@ -111,6 +113,7 @@ var noop = function noop() {};
|
|
|
111
113
|
var CustomItemComponentWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
112
114
|
var customRenderItem = props.customRenderItem,
|
|
113
115
|
isSelected = props.isSelected,
|
|
116
|
+
itemIsDisabled = props.itemIsDisabled,
|
|
114
117
|
ariaLabel = props.ariaLabel,
|
|
115
118
|
itemsLength = props.itemsLength,
|
|
116
119
|
customItemRef = props.customItemRef,
|
|
@@ -118,8 +121,8 @@ var CustomItemComponentWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
|
118
121
|
itemIndex = props.itemIndex;
|
|
119
122
|
var Comp = customRenderItem;
|
|
120
123
|
var listItemClasses = useMemo(function () {
|
|
121
|
-
return [customRenderItemDivStyle, isSelected && selectedStyle];
|
|
122
|
-
}, [isSelected]);
|
|
124
|
+
return [customRenderItemDivStyle, isSelected && !itemIsDisabled && selectedStyle, itemIsDisabled && disabledStyle];
|
|
125
|
+
}, [isSelected, itemIsDisabled]);
|
|
123
126
|
return jsx("div", {
|
|
124
127
|
"aria-selected": isSelected,
|
|
125
128
|
role: "option",
|
|
@@ -152,12 +155,29 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
152
155
|
onItemClick = _ref2.onItemClick,
|
|
153
156
|
itemIndex = _ref2.itemIndex,
|
|
154
157
|
ariaLabel = _ref2.ariaLabel,
|
|
155
|
-
moreElementsInQuickInsertViewEnabled = _ref2.moreElementsInQuickInsertViewEnabled
|
|
158
|
+
moreElementsInQuickInsertViewEnabled = _ref2.moreElementsInQuickInsertViewEnabled,
|
|
159
|
+
api = _ref2.api,
|
|
160
|
+
firstOnlineSupportedIndex = _ref2.firstOnlineSupportedIndex;
|
|
161
|
+
var _useSharedPluginState = useSharedPluginState(api, ['connectivity']),
|
|
162
|
+
connectivityState = _useSharedPluginState.connectivityState;
|
|
163
|
+
var isItemDisabled = function isItemDisabled(item) {
|
|
164
|
+
var _item$isDisabledOffli;
|
|
165
|
+
return (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline' && ((_item$isDisabledOffli = item === null || item === void 0 ? void 0 : item.isDisabledOffline) !== null && _item$isDisabledOffli !== void 0 ? _item$isDisabledOffli : false);
|
|
166
|
+
};
|
|
167
|
+
var itemIsDisabled = isItemDisabled(item);
|
|
168
|
+
var isFirstEnabledIndex = (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline' && itemIndex === firstOnlineSupportedIndex && selectedIndex === -1;
|
|
169
|
+
|
|
156
170
|
/**
|
|
157
171
|
* To select and highlight the first Item when no item is selected
|
|
158
172
|
* However selectedIndex remains -1, So that user does not skip the first item when down arrow key is used from typeahead query(inputQuery.tsx)
|
|
159
173
|
*/
|
|
160
|
-
var isSelected =
|
|
174
|
+
var isSelected = false;
|
|
175
|
+
// Feature gated - connectivity is only available on desktop and behind a feature gate on full page mode
|
|
176
|
+
if (connectivityState === undefined) {
|
|
177
|
+
isSelected = itemIndex === selectedIndex || selectedIndex === -1 && itemIndex === 0;
|
|
178
|
+
} else {
|
|
179
|
+
isSelected = itemIndex === selectedIndex || selectedIndex === -1 && (itemIndex === 0 || isFirstEnabledIndex) && !itemIsDisabled;
|
|
180
|
+
}
|
|
161
181
|
|
|
162
182
|
// Assistive text
|
|
163
183
|
var intl = useIntl();
|
|
@@ -174,14 +194,17 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
174
194
|
}));
|
|
175
195
|
}, [icon, title, moreElementsInQuickInsertViewEnabled]);
|
|
176
196
|
var insertSelectedItem = useCallback(function () {
|
|
197
|
+
if (itemIsDisabled) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
177
200
|
onItemClick(SelectItemMode.SELECTED, itemIndex);
|
|
178
|
-
}, [onItemClick, itemIndex]);
|
|
201
|
+
}, [onItemClick, itemIndex, itemIsDisabled]);
|
|
179
202
|
var customItemRef = React.useRef(null);
|
|
180
203
|
var buttonItemRef = React.useRef(null);
|
|
181
|
-
var shouldUpdateFocus = selectedIndex === itemIndex;
|
|
204
|
+
var shouldUpdateFocus = selectedIndex === itemIndex && !isFirstEnabledIndex;
|
|
182
205
|
var listItemClasses = useMemo(function () {
|
|
183
|
-
return [selectionFrame, isSelected && selectedStyle];
|
|
184
|
-
}, [isSelected]);
|
|
206
|
+
return [selectionFrame, isSelected && !itemIsDisabled && selectedStyle];
|
|
207
|
+
}, [isSelected, itemIsDisabled]);
|
|
185
208
|
useLayoutEffect(function () {
|
|
186
209
|
if (shouldUpdateFocus) {
|
|
187
210
|
var _customItemRef$curren;
|
|
@@ -196,6 +219,7 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
196
219
|
}, [buttonItemRef, shouldUpdateFocus]);
|
|
197
220
|
if (customRenderItem) {
|
|
198
221
|
return jsx(CustomItemComponentWrapper, {
|
|
222
|
+
itemIsDisabled: itemIsDisabled,
|
|
199
223
|
customRenderItem: customRenderItem,
|
|
200
224
|
isSelected: isSelected,
|
|
201
225
|
ariaLabel: ariaLabel,
|
|
@@ -223,7 +247,8 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
223
247
|
"aria-setsize": itemsLength,
|
|
224
248
|
"aria-posinset": itemIndex,
|
|
225
249
|
role: "option",
|
|
226
|
-
ref: buttonItemRef
|
|
250
|
+
ref: buttonItemRef,
|
|
251
|
+
isDisabled: itemIsDisabled
|
|
227
252
|
// @ts-ignore
|
|
228
253
|
,
|
|
229
254
|
css: listItemClasses
|
|
@@ -234,13 +259,13 @@ export var TypeAheadListItem = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
234
259
|
}, jsx("div", {
|
|
235
260
|
css: itemBody
|
|
236
261
|
}, jsx("div", {
|
|
237
|
-
css: [itemTitle, moreElementsInQuickInsertViewEnabled && itemTitleOverride]
|
|
262
|
+
css: [itemTitle, moreElementsInQuickInsertViewEnabled && itemTitleOverride, itemIsDisabled && disabledStyle]
|
|
238
263
|
}, item.title), jsx("div", {
|
|
239
264
|
css: itemAfter
|
|
240
265
|
}, item.keyshortcut && jsx("div", {
|
|
241
266
|
css: shortcutStyle
|
|
242
267
|
}, item.keyshortcut))), jsx("div", {
|
|
243
|
-
css: [itemDescription, moreElementsInQuickInsertViewEnabled && itemDescriptionOverride]
|
|
268
|
+
css: [itemDescription, moreElementsInQuickInsertViewEnabled && itemDescriptionOverride, itemIsDisabled && disabledStyle]
|
|
244
269
|
}, item.description)))))
|
|
245
270
|
);
|
|
246
271
|
});
|
|
@@ -17,7 +17,7 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
17
17
|
decorationElement = typeAheadState.decorationElement,
|
|
18
18
|
decorationSet = typeAheadState.decorationSet,
|
|
19
19
|
query = typeAheadState.query;
|
|
20
|
-
var _useItemInsert = useItemInsert(triggerHandler, editorView, items),
|
|
20
|
+
var _useItemInsert = useItemInsert(triggerHandler, editorView, items, api),
|
|
21
21
|
_useItemInsert2 = _slicedToArray(_useItemInsert, 3),
|
|
22
22
|
onItemInsert = _useItemInsert2[0],
|
|
23
23
|
onTextInsert = _useItemInsert2[1],
|
|
@@ -25,9 +25,9 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
25
25
|
var setSelectedItem = React.useCallback(function (_ref2) {
|
|
26
26
|
var nextIndex = _ref2.index;
|
|
27
27
|
queueMicrotask(function () {
|
|
28
|
-
updateSelectedIndex(nextIndex)(editorView.state, editorView.dispatch);
|
|
28
|
+
updateSelectedIndex(nextIndex, api)(editorView.state, editorView.dispatch);
|
|
29
29
|
});
|
|
30
|
-
}, [editorView]);
|
|
30
|
+
}, [editorView, api]);
|
|
31
31
|
var insertItem = React.useCallback(function () {
|
|
32
32
|
var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SelectItemMode.SELECTED;
|
|
33
33
|
var index = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -223,7 +223,9 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
223
223
|
ariaLabel: null,
|
|
224
224
|
preventOverflow: true
|
|
225
225
|
}, jsx("div", {
|
|
226
|
-
css: [typeAheadContent, moreElementsInQuickInsertViewEnabled && typeAheadContentOverride]
|
|
226
|
+
css: [typeAheadContent, moreElementsInQuickInsertViewEnabled && typeAheadContentOverride]
|
|
227
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
228
|
+
,
|
|
227
229
|
tabIndex: 0
|
|
228
230
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
229
231
|
,
|
|
@@ -240,7 +242,8 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
240
242
|
editorView: editorView,
|
|
241
243
|
decorationElement: anchorElement,
|
|
242
244
|
triggerHandler: triggerHandler,
|
|
243
|
-
moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled
|
|
245
|
+
moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled,
|
|
246
|
+
api: api
|
|
244
247
|
})));
|
|
245
248
|
});
|
|
246
249
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -2,7 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
4
4
|
import { updateQuery } from '../pm-plugins/commands/update-query';
|
|
5
|
-
import {
|
|
5
|
+
import { itemIsDisabled } from '../pm-plugins/item-is-disabled';
|
|
6
|
+
import { getPluginState, moveSelectedIndex, skipForwardToSafeItem } from '../pm-plugins/utils';
|
|
6
7
|
import { useItemInsert } from './hooks/use-item-insert';
|
|
7
8
|
import { useLoadItems } from './hooks/use-load-items';
|
|
8
9
|
import { useOnForceSelect } from './hooks/use-on-force-select';
|
|
@@ -18,7 +19,8 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
18
19
|
inputMethod = _ref.inputMethod,
|
|
19
20
|
getDecorationPosition = _ref.getDecorationPosition,
|
|
20
21
|
reopenQuery = _ref.reopenQuery,
|
|
21
|
-
onUndoRedo = _ref.onUndoRedo
|
|
22
|
+
onUndoRedo = _ref.onUndoRedo,
|
|
23
|
+
api = _ref.api;
|
|
22
24
|
var _useState = useState(false),
|
|
23
25
|
_useState2 = _slicedToArray(_useState, 2),
|
|
24
26
|
closed = _useState2[0],
|
|
@@ -33,22 +35,24 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
33
35
|
useLayoutEffect(function () {
|
|
34
36
|
queryRef.current = query;
|
|
35
37
|
}, [query]);
|
|
36
|
-
var _useItemInsert = useItemInsert(triggerHandler, editorView, items),
|
|
38
|
+
var _useItemInsert = useItemInsert(triggerHandler, editorView, items, api),
|
|
37
39
|
_useItemInsert2 = _slicedToArray(_useItemInsert, 2),
|
|
38
40
|
onItemInsert = _useItemInsert2[0],
|
|
39
41
|
onTextInsert = _useItemInsert2[1];
|
|
40
42
|
var selectNextItem = useMemo(function () {
|
|
41
43
|
return moveSelectedIndex({
|
|
42
44
|
editorView: editorView,
|
|
43
|
-
direction: 'next'
|
|
45
|
+
direction: 'next',
|
|
46
|
+
api: api
|
|
44
47
|
});
|
|
45
|
-
}, [editorView]);
|
|
48
|
+
}, [editorView, api]);
|
|
46
49
|
var selectPreviousItem = useMemo(function () {
|
|
47
50
|
return moveSelectedIndex({
|
|
48
51
|
editorView: editorView,
|
|
49
|
-
direction: 'previous'
|
|
52
|
+
direction: 'previous',
|
|
53
|
+
api: api
|
|
50
54
|
});
|
|
51
|
-
}, [editorView]);
|
|
55
|
+
}, [editorView, api]);
|
|
52
56
|
var cancel = useCallback(function (_ref2) {
|
|
53
57
|
var setSelectionAt = _ref2.setSelectionAt,
|
|
54
58
|
addPrefixTrigger = _ref2.addPrefixTrigger,
|
|
@@ -67,6 +71,13 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
67
71
|
var view = editorViewRef.current;
|
|
68
72
|
var _ref3 = getPluginState(view.state),
|
|
69
73
|
selectedIndex = _ref3.selectedIndex;
|
|
74
|
+
var safeSelectedIndex = skipForwardToSafeItem(selectedIndex, 1, items.length, function (idx) {
|
|
75
|
+
return itemIsDisabled(items[idx], api);
|
|
76
|
+
});
|
|
77
|
+
// If the only safe index is -1 then none are safe - do not insert item
|
|
78
|
+
if (safeSelectedIndex === -1) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
70
81
|
setClosed(true);
|
|
71
82
|
queueMicrotask(function () {
|
|
72
83
|
onItemInsert({
|
|
@@ -75,7 +86,7 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
75
86
|
query: queryRef.current
|
|
76
87
|
});
|
|
77
88
|
});
|
|
78
|
-
}, [onItemInsert]);
|
|
89
|
+
}, [onItemInsert, api, items]);
|
|
79
90
|
var showTypeAheadPopupList = useCallback(function () {}, []);
|
|
80
91
|
var closePopup = useCallback(function () {
|
|
81
92
|
setClosed(true);
|
|
@@ -4,6 +4,7 @@ import { closeTypeAhead } from '../../pm-plugins/commands/close-type-ahead';
|
|
|
4
4
|
import { insertTypeAheadItem } from '../../pm-plugins/commands/insert-type-ahead-item';
|
|
5
5
|
import { setSelectionBeforeQuery } from '../../pm-plugins/commands/set-selection-before-query';
|
|
6
6
|
import { CloseSelectionOptions } from '../../pm-plugins/constants';
|
|
7
|
+
import { itemIsDisabled } from '../../pm-plugins/item-is-disabled';
|
|
7
8
|
var insertRawQuery = function insertRawQuery(_ref) {
|
|
8
9
|
var view = _ref.view,
|
|
9
10
|
setSelectionAt = _ref.setSelectionAt,
|
|
@@ -24,7 +25,7 @@ var insertRawQuery = function insertRawQuery(_ref) {
|
|
|
24
25
|
view.focus();
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
|
-
export var useItemInsert = function useItemInsert(triggerHandler, editorView, items) {
|
|
28
|
+
export var useItemInsert = function useItemInsert(triggerHandler, editorView, items, api) {
|
|
28
29
|
var editorViewRef = useRef(editorView);
|
|
29
30
|
var itemsRef = useRef(items);
|
|
30
31
|
var onTextInsert = useCallback(function (_ref2) {
|
|
@@ -60,6 +61,10 @@ export var useItemInsert = function useItemInsert(triggerHandler, editorView, it
|
|
|
60
61
|
if (!itemToInsert) {
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
64
|
+
var isDisabled = itemIsDisabled(itemToInsert, api);
|
|
65
|
+
if (isDisabled) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
63
68
|
var view = editorViewRef.current;
|
|
64
69
|
insertTypeAheadItem(view)({
|
|
65
70
|
item: itemToInsert,
|
|
@@ -68,7 +73,7 @@ export var useItemInsert = function useItemInsert(triggerHandler, editorView, it
|
|
|
68
73
|
query: query,
|
|
69
74
|
sourceListItem: sourceListItem
|
|
70
75
|
});
|
|
71
|
-
}, [triggerHandler, onTextInsert]);
|
|
76
|
+
}, [triggerHandler, onTextInsert, api]);
|
|
72
77
|
var onItemMatch = useCallback(function (_ref4) {
|
|
73
78
|
var mode = _ref4.mode,
|
|
74
79
|
query = _ref4.query;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
|
|
1
|
+
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
3
|
+
export declare const updateSelectedIndex: (selectedIndex: number, api: ExtractInjectionAPI<TypeAheadPlugin> | undefined) => Command;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { TypeAheadPlugin } from '../typeAheadPluginType';
|
|
3
5
|
import type { CreateTypeAheadDecorations, PopupMountPointReference, RemoveTypeAheadDecorations } from '../types';
|
|
4
6
|
type FactoryProps = {
|
|
5
7
|
intl: IntlShape;
|
|
6
8
|
popupMountRef: PopupMountPointReference;
|
|
7
9
|
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
10
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
8
11
|
};
|
|
9
12
|
type FactoryReturn = {
|
|
10
13
|
createDecorations: CreateTypeAheadDecorations;
|
|
11
14
|
removeDecorations: RemoveTypeAheadDecorations;
|
|
12
15
|
};
|
|
13
|
-
export declare const factoryDecorations: ({ intl, popupMountRef, nodeViewPortalProviderAPI, }: FactoryProps) => FactoryReturn;
|
|
16
|
+
export declare const factoryDecorations: ({ intl, popupMountRef, nodeViewPortalProviderAPI, api, }: FactoryProps) => FactoryReturn;
|
|
14
17
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
3
|
+
import type { TypeAheadItem } from '../types';
|
|
4
|
+
export declare const itemIsDisabled: (item: TypeAheadItem | undefined, api: ExtractInjectionAPI<TypeAheadPlugin> | undefined) => boolean;
|
|
@@ -2,6 +2,8 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
5
7
|
import type { PopupMountPointReference, TypeAheadHandler } from '../types';
|
|
6
8
|
type Props = {
|
|
7
9
|
reactDispatch: Dispatch;
|
|
@@ -9,6 +11,7 @@ type Props = {
|
|
|
9
11
|
typeAheadHandlers: Array<TypeAheadHandler>;
|
|
10
12
|
getIntl: () => IntlShape;
|
|
11
13
|
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
14
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
12
15
|
};
|
|
13
|
-
export declare function createPlugin({ reactDispatch, popupMountRef, typeAheadHandlers, getIntl, nodeViewPortalProviderAPI, }: Props): SafePlugin;
|
|
16
|
+
export declare function createPlugin({ reactDispatch, popupMountRef, typeAheadHandlers, getIntl, nodeViewPortalProviderAPI, api, }: Props): SafePlugin;
|
|
14
17
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
4
6
|
import type { TypeAheadHandler, TypeAheadItem } from '../types';
|
|
5
7
|
export declare const isTypeAheadHandler: (handler: any) => handler is TypeAheadHandler;
|
|
6
8
|
/** Is a typeahead plugin open? */
|
|
@@ -10,6 +12,8 @@ export declare const getTypeAheadHandler: (editorState: EditorState) => TypeAhea
|
|
|
10
12
|
export declare const getTypeAheadQuery: (editorState: EditorState) => string | undefined;
|
|
11
13
|
export declare const isTypeAheadAllowed: (state: EditorState) => boolean;
|
|
12
14
|
export declare const findHandler: (id: string, state: EditorState) => TypeAheadHandler | null;
|
|
15
|
+
export declare const skipForwardToSafeItem: (currentIndex: number, nextIndex: number, listSize: number, itemIsDisabled: (idx: number) => boolean) => number;
|
|
16
|
+
export declare const skipBackwardToSafeItem: (currentIndex: number, nextIndex: number, itemIsDisabled: (idx: number) => boolean) => number;
|
|
13
17
|
export declare const findHandlerByTrigger: ({ trigger, editorState, }: {
|
|
14
18
|
trigger: string;
|
|
15
19
|
editorState: EditorState;
|
|
@@ -17,8 +21,9 @@ export declare const findHandlerByTrigger: ({ trigger, editorState, }: {
|
|
|
17
21
|
type MoveSelectedIndexProps = {
|
|
18
22
|
editorView: EditorView;
|
|
19
23
|
direction: 'next' | 'previous';
|
|
24
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
20
25
|
};
|
|
21
|
-
export declare const moveSelectedIndex: ({ editorView, direction }: MoveSelectedIndexProps) => () => void;
|
|
26
|
+
export declare const moveSelectedIndex: ({ editorView, direction, api }: MoveSelectedIndexProps) => () => void;
|
|
22
27
|
type TypeAheadAssistiveLabels = {
|
|
23
28
|
popupAriaLabel: string;
|
|
24
29
|
listItemAriaLabel?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
2
2
|
import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
4
5
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { type TypeAheadInputMethod, type TypeAheadPluginOptions, type TypeAheadPluginSharedState } from './types';
|
|
@@ -26,7 +27,11 @@ type CloseTypeAheadProps = {
|
|
|
26
27
|
*/
|
|
27
28
|
export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
|
|
28
29
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
29
|
-
dependencies: [
|
|
30
|
+
dependencies: [
|
|
31
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
32
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
33
|
+
OptionalPlugin<ConnectivityPlugin>
|
|
34
|
+
];
|
|
30
35
|
sharedState: TypeAheadPluginSharedState;
|
|
31
36
|
actions: {
|
|
32
37
|
isOpen: (editorState: EditorState) => boolean;
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
7
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
8
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
9
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
9
11
|
import type { TypeAheadHandler, TypeAheadItem } from '../types';
|
|
10
12
|
export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlProps<{
|
|
11
13
|
items: Array<TypeAheadItem>;
|
|
@@ -16,6 +18,7 @@ export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlP
|
|
|
16
18
|
decorationElement: HTMLElement;
|
|
17
19
|
triggerHandler?: TypeAheadHandler | undefined;
|
|
18
20
|
moreElementsInQuickInsertViewEnabled?: boolean | undefined;
|
|
21
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
19
22
|
} & WrappedComponentProps>> & {
|
|
20
23
|
WrappedComponent: React.ComponentType<{
|
|
21
24
|
items: Array<TypeAheadItem>;
|
|
@@ -26,5 +29,6 @@ export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlP
|
|
|
26
29
|
decorationElement: HTMLElement;
|
|
27
30
|
triggerHandler?: TypeAheadHandler | undefined;
|
|
28
31
|
moreElementsInQuickInsertViewEnabled?: boolean | undefined;
|
|
32
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
29
33
|
} & WrappedComponentProps>;
|
|
30
34
|
};
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
8
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
8
10
|
import type { TypeAheadItem } from '../types';
|
|
9
11
|
export declare const itemIcon: import("@emotion/react").SerializedStyles;
|
|
10
12
|
type TypeAheadListItemProps = {
|
|
@@ -15,6 +17,8 @@ type TypeAheadListItemProps = {
|
|
|
15
17
|
ariaLabel?: string;
|
|
16
18
|
onItemClick: (mode: SelectItemMode, index: number) => void;
|
|
17
19
|
moreElementsInQuickInsertViewEnabled?: boolean;
|
|
20
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
21
|
+
firstOnlineSupportedIndex: number;
|
|
18
22
|
};
|
|
19
|
-
export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, moreElementsInQuickInsertViewEnabled, }: TypeAheadListItemProps) => jsx.JSX.Element>;
|
|
23
|
+
export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, moreElementsInQuickInsertViewEnabled, api, firstOnlineSupportedIndex, }: TypeAheadListItemProps) => jsx.JSX.Element>;
|
|
20
24
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { TypeAheadPlugin } from '../typeAheadPluginType';
|
|
3
5
|
import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
|
|
4
6
|
type WrapperProps = {
|
|
5
7
|
triggerHandler: TypeAheadHandler;
|
|
@@ -13,6 +15,7 @@ type WrapperProps = {
|
|
|
13
15
|
popupsBoundariesElement?: HTMLElement;
|
|
14
16
|
popupsScrollableElement?: HTMLElement;
|
|
15
17
|
inputMethod?: TypeAheadInputMethod;
|
|
18
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
16
19
|
};
|
|
17
|
-
export declare const WrapperTypeAhead: React.MemoExoticComponent<({ triggerHandler, editorView, anchorElement, shouldFocusCursorInsideQuery, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, inputMethod, getDecorationPosition, reopenQuery, onUndoRedo, }: WrapperProps) => JSX.Element | null>;
|
|
20
|
+
export declare const WrapperTypeAhead: React.MemoExoticComponent<({ triggerHandler, editorView, anchorElement, shouldFocusCursorInsideQuery, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, inputMethod, getDecorationPosition, reopenQuery, onUndoRedo, api, }: WrapperProps) => JSX.Element | null>;
|
|
18
21
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
2
4
|
import type { OnInsertSelectedItem, OnItemMatch, OnTextInsert, TypeAheadHandler, TypeAheadItem } from '../../types';
|
|
3
|
-
export declare const useItemInsert: (triggerHandler: TypeAheadHandler, editorView: EditorView, items: Array<TypeAheadItem>) => [OnInsertSelectedItem, OnTextInsert, OnItemMatch];
|
|
5
|
+
export declare const useItemInsert: (triggerHandler: TypeAheadHandler, editorView: EditorView, items: Array<TypeAheadItem>, api: ExtractInjectionAPI<TypeAheadPlugin> | undefined) => [OnInsertSelectedItem, OnTextInsert, OnItemMatch];
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
-
|
|
1
|
+
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
3
|
+
export declare const updateSelectedIndex: (selectedIndex: number, api: ExtractInjectionAPI<TypeAheadPlugin> | undefined) => Command;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { TypeAheadPlugin } from '../typeAheadPluginType';
|
|
3
5
|
import type { CreateTypeAheadDecorations, PopupMountPointReference, RemoveTypeAheadDecorations } from '../types';
|
|
4
6
|
type FactoryProps = {
|
|
5
7
|
intl: IntlShape;
|
|
6
8
|
popupMountRef: PopupMountPointReference;
|
|
7
9
|
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
10
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
8
11
|
};
|
|
9
12
|
type FactoryReturn = {
|
|
10
13
|
createDecorations: CreateTypeAheadDecorations;
|
|
11
14
|
removeDecorations: RemoveTypeAheadDecorations;
|
|
12
15
|
};
|
|
13
|
-
export declare const factoryDecorations: ({ intl, popupMountRef, nodeViewPortalProviderAPI, }: FactoryProps) => FactoryReturn;
|
|
16
|
+
export declare const factoryDecorations: ({ intl, popupMountRef, nodeViewPortalProviderAPI, api, }: FactoryProps) => FactoryReturn;
|
|
14
17
|
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
3
|
+
import type { TypeAheadItem } from '../types';
|
|
4
|
+
export declare const itemIsDisabled: (item: TypeAheadItem | undefined, api: ExtractInjectionAPI<TypeAheadPlugin> | undefined) => boolean;
|
|
@@ -2,6 +2,8 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
6
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
5
7
|
import type { PopupMountPointReference, TypeAheadHandler } from '../types';
|
|
6
8
|
type Props = {
|
|
7
9
|
reactDispatch: Dispatch;
|
|
@@ -9,6 +11,7 @@ type Props = {
|
|
|
9
11
|
typeAheadHandlers: Array<TypeAheadHandler>;
|
|
10
12
|
getIntl: () => IntlShape;
|
|
11
13
|
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
14
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
12
15
|
};
|
|
13
|
-
export declare function createPlugin({ reactDispatch, popupMountRef, typeAheadHandlers, getIntl, nodeViewPortalProviderAPI, }: Props): SafePlugin;
|
|
16
|
+
export declare function createPlugin({ reactDispatch, popupMountRef, typeAheadHandlers, getIntl, nodeViewPortalProviderAPI, api, }: Props): SafePlugin;
|
|
14
17
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
4
6
|
import type { TypeAheadHandler, TypeAheadItem } from '../types';
|
|
5
7
|
export declare const isTypeAheadHandler: (handler: any) => handler is TypeAheadHandler;
|
|
6
8
|
/** Is a typeahead plugin open? */
|
|
@@ -10,6 +12,8 @@ export declare const getTypeAheadHandler: (editorState: EditorState) => TypeAhea
|
|
|
10
12
|
export declare const getTypeAheadQuery: (editorState: EditorState) => string | undefined;
|
|
11
13
|
export declare const isTypeAheadAllowed: (state: EditorState) => boolean;
|
|
12
14
|
export declare const findHandler: (id: string, state: EditorState) => TypeAheadHandler | null;
|
|
15
|
+
export declare const skipForwardToSafeItem: (currentIndex: number, nextIndex: number, listSize: number, itemIsDisabled: (idx: number) => boolean) => number;
|
|
16
|
+
export declare const skipBackwardToSafeItem: (currentIndex: number, nextIndex: number, itemIsDisabled: (idx: number) => boolean) => number;
|
|
13
17
|
export declare const findHandlerByTrigger: ({ trigger, editorState, }: {
|
|
14
18
|
trigger: string;
|
|
15
19
|
editorState: EditorState;
|
|
@@ -17,8 +21,9 @@ export declare const findHandlerByTrigger: ({ trigger, editorState, }: {
|
|
|
17
21
|
type MoveSelectedIndexProps = {
|
|
18
22
|
editorView: EditorView;
|
|
19
23
|
direction: 'next' | 'previous';
|
|
24
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
20
25
|
};
|
|
21
|
-
export declare const moveSelectedIndex: ({ editorView, direction }: MoveSelectedIndexProps) => () => void;
|
|
26
|
+
export declare const moveSelectedIndex: ({ editorView, direction, api }: MoveSelectedIndexProps) => () => void;
|
|
22
27
|
type TypeAheadAssistiveLabels = {
|
|
23
28
|
popupAriaLabel: string;
|
|
24
29
|
listItemAriaLabel?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
2
2
|
import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
|
|
4
5
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
5
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { type TypeAheadInputMethod, type TypeAheadPluginOptions, type TypeAheadPluginSharedState } from './types';
|
|
@@ -28,7 +29,8 @@ export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
|
|
|
28
29
|
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
29
30
|
dependencies: [
|
|
30
31
|
OptionalPlugin<AnalyticsPlugin>,
|
|
31
|
-
OptionalPlugin<FeatureFlagsPlugin
|
|
32
|
+
OptionalPlugin<FeatureFlagsPlugin>,
|
|
33
|
+
OptionalPlugin<ConnectivityPlugin>
|
|
32
34
|
];
|
|
33
35
|
sharedState: TypeAheadPluginSharedState;
|
|
34
36
|
actions: {
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import type { WrappedComponentProps } from 'react-intl-next';
|
|
7
7
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
8
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
9
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
9
11
|
import type { TypeAheadHandler, TypeAheadItem } from '../types';
|
|
10
12
|
export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlProps<{
|
|
11
13
|
items: Array<TypeAheadItem>;
|
|
@@ -16,6 +18,7 @@ export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlP
|
|
|
16
18
|
decorationElement: HTMLElement;
|
|
17
19
|
triggerHandler?: TypeAheadHandler | undefined;
|
|
18
20
|
moreElementsInQuickInsertViewEnabled?: boolean | undefined;
|
|
21
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
19
22
|
} & WrappedComponentProps>> & {
|
|
20
23
|
WrappedComponent: React.ComponentType<{
|
|
21
24
|
items: Array<TypeAheadItem>;
|
|
@@ -26,5 +29,6 @@ export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlP
|
|
|
26
29
|
decorationElement: HTMLElement;
|
|
27
30
|
triggerHandler?: TypeAheadHandler | undefined;
|
|
28
31
|
moreElementsInQuickInsertViewEnabled?: boolean | undefined;
|
|
32
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
29
33
|
} & WrappedComponentProps>;
|
|
30
34
|
};
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { jsx } from '@emotion/react';
|
|
7
7
|
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
8
|
+
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
9
|
+
import { type TypeAheadPlugin } from '../typeAheadPluginType';
|
|
8
10
|
import type { TypeAheadItem } from '../types';
|
|
9
11
|
export declare const itemIcon: import("@emotion/react").SerializedStyles;
|
|
10
12
|
type TypeAheadListItemProps = {
|
|
@@ -15,6 +17,8 @@ type TypeAheadListItemProps = {
|
|
|
15
17
|
ariaLabel?: string;
|
|
16
18
|
onItemClick: (mode: SelectItemMode, index: number) => void;
|
|
17
19
|
moreElementsInQuickInsertViewEnabled?: boolean;
|
|
20
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
21
|
+
firstOnlineSupportedIndex: number;
|
|
18
22
|
};
|
|
19
|
-
export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, moreElementsInQuickInsertViewEnabled, }: TypeAheadListItemProps) => jsx.JSX.Element>;
|
|
23
|
+
export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, moreElementsInQuickInsertViewEnabled, api, firstOnlineSupportedIndex, }: TypeAheadListItemProps) => jsx.JSX.Element>;
|
|
20
24
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { TypeAheadPlugin } from '../typeAheadPluginType';
|
|
3
5
|
import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
|
|
4
6
|
type WrapperProps = {
|
|
5
7
|
triggerHandler: TypeAheadHandler;
|
|
@@ -13,6 +15,7 @@ type WrapperProps = {
|
|
|
13
15
|
popupsBoundariesElement?: HTMLElement;
|
|
14
16
|
popupsScrollableElement?: HTMLElement;
|
|
15
17
|
inputMethod?: TypeAheadInputMethod;
|
|
18
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
16
19
|
};
|
|
17
|
-
export declare const WrapperTypeAhead: React.MemoExoticComponent<({ triggerHandler, editorView, anchorElement, shouldFocusCursorInsideQuery, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, inputMethod, getDecorationPosition, reopenQuery, onUndoRedo, }: WrapperProps) => JSX.Element | null>;
|
|
20
|
+
export declare const WrapperTypeAhead: React.MemoExoticComponent<({ triggerHandler, editorView, anchorElement, shouldFocusCursorInsideQuery, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, inputMethod, getDecorationPosition, reopenQuery, onUndoRedo, api, }: WrapperProps) => JSX.Element | null>;
|
|
18
21
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
+
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
2
4
|
import type { OnInsertSelectedItem, OnItemMatch, OnTextInsert, TypeAheadHandler, TypeAheadItem } from '../../types';
|
|
3
|
-
export declare const useItemInsert: (triggerHandler: TypeAheadHandler, editorView: EditorView, items: Array<TypeAheadItem>) => [
|
|
5
|
+
export declare const useItemInsert: (triggerHandler: TypeAheadHandler, editorView: EditorView, items: Array<TypeAheadItem>, api: ExtractInjectionAPI<TypeAheadPlugin> | undefined) => [
|
|
4
6
|
OnInsertSelectedItem,
|
|
5
7
|
OnTextInsert,
|
|
6
8
|
OnItemMatch
|