@atlaskit/editor-plugin-type-ahead 1.11.2 → 1.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/pm-plugins/actions.js +1 -0
- package/dist/cjs/pm-plugins/api.js +2 -0
- package/dist/cjs/pm-plugins/commands/update-list-error.js +24 -0
- package/dist/cjs/pm-plugins/input-rules.js +3 -0
- package/dist/cjs/pm-plugins/main.js +3 -0
- package/dist/cjs/pm-plugins/reducer.js +8 -0
- package/dist/cjs/pm-plugins/utils.js +49 -11
- package/dist/cjs/typeAheadPlugin.js +3 -1
- package/dist/cjs/ui/AssistiveText.js +7 -0
- package/dist/cjs/ui/InputQuery.js +24 -0
- package/dist/cjs/ui/TypeAheadErrorFallback/EmptyState.js +38 -0
- package/dist/cjs/ui/TypeAheadErrorFallback/GenericErrorSVG.js +67 -0
- package/dist/cjs/ui/TypeAheadErrorFallback/MinHeightContainer.js +41 -0
- package/dist/cjs/ui/TypeAheadErrorFallback/index.js +38 -0
- package/dist/cjs/ui/TypeAheadList.js +6 -0
- package/dist/cjs/ui/TypeAheadListItem.js +1 -0
- package/dist/cjs/ui/TypeAheadMenu.js +7 -2
- package/dist/cjs/ui/TypeAheadPopup.js +22 -2
- package/dist/cjs/ui/WrapperTypeAhead.js +15 -4
- package/dist/cjs/ui/hooks/use-item-insert.js +4 -1
- package/dist/cjs/ui/hooks/use-load-items.js +13 -0
- package/dist/es2019/pm-plugins/actions.js +1 -0
- package/dist/es2019/pm-plugins/api.js +2 -0
- package/dist/es2019/pm-plugins/commands/update-list-error.js +18 -0
- package/dist/es2019/pm-plugins/input-rules.js +3 -0
- package/dist/es2019/pm-plugins/main.js +3 -0
- package/dist/es2019/pm-plugins/reducer.js +11 -0
- package/dist/es2019/pm-plugins/utils.js +44 -4
- package/dist/es2019/typeAheadPlugin.js +3 -1
- package/dist/es2019/ui/AssistiveText.js +7 -0
- package/dist/es2019/ui/InputQuery.js +25 -1
- package/dist/es2019/ui/TypeAheadErrorFallback/EmptyState.js +32 -0
- package/dist/es2019/ui/TypeAheadErrorFallback/GenericErrorSVG.js +59 -0
- package/dist/es2019/ui/TypeAheadErrorFallback/MinHeightContainer.js +33 -0
- package/dist/es2019/ui/TypeAheadErrorFallback/index.js +29 -0
- package/dist/es2019/ui/TypeAheadList.js +6 -0
- package/dist/es2019/ui/TypeAheadListItem.js +1 -0
- package/dist/es2019/ui/TypeAheadMenu.js +7 -2
- package/dist/es2019/ui/TypeAheadPopup.js +22 -2
- package/dist/es2019/ui/WrapperTypeAhead.js +13 -2
- package/dist/es2019/ui/hooks/use-item-insert.js +4 -1
- package/dist/es2019/ui/hooks/use-load-items.js +13 -0
- package/dist/esm/pm-plugins/actions.js +1 -0
- package/dist/esm/pm-plugins/api.js +2 -0
- package/dist/esm/pm-plugins/commands/update-list-error.js +18 -0
- package/dist/esm/pm-plugins/input-rules.js +3 -0
- package/dist/esm/pm-plugins/main.js +3 -0
- package/dist/esm/pm-plugins/reducer.js +8 -0
- package/dist/esm/pm-plugins/utils.js +49 -11
- package/dist/esm/typeAheadPlugin.js +3 -1
- package/dist/esm/ui/AssistiveText.js +7 -0
- package/dist/esm/ui/InputQuery.js +24 -0
- package/dist/esm/ui/TypeAheadErrorFallback/EmptyState.js +31 -0
- package/dist/esm/ui/TypeAheadErrorFallback/GenericErrorSVG.js +59 -0
- package/dist/esm/ui/TypeAheadErrorFallback/MinHeightContainer.js +33 -0
- package/dist/esm/ui/TypeAheadErrorFallback/index.js +31 -0
- package/dist/esm/ui/TypeAheadList.js +6 -0
- package/dist/esm/ui/TypeAheadListItem.js +1 -0
- package/dist/esm/ui/TypeAheadMenu.js +7 -2
- package/dist/esm/ui/TypeAheadPopup.js +22 -2
- package/dist/esm/ui/WrapperTypeAhead.js +15 -4
- package/dist/esm/ui/hooks/use-item-insert.js +4 -1
- package/dist/esm/ui/hooks/use-load-items.js +13 -0
- package/dist/types/pm-plugins/actions.d.ts +1 -0
- package/dist/types/pm-plugins/commands/update-list-error.d.ts +2 -0
- package/dist/types/pm-plugins/utils.d.ts +12 -2
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/ui/TypeAheadErrorFallback/EmptyState.d.ts +9 -0
- package/dist/types/ui/TypeAheadErrorFallback/GenericErrorSVG.d.ts +6 -0
- package/dist/types/ui/TypeAheadErrorFallback/MinHeightContainer.d.ts +9 -0
- package/dist/types/ui/TypeAheadErrorFallback/index.d.ts +6 -0
- package/dist/types/ui/TypeAheadPopup.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/commands/update-list-error.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/utils.d.ts +12 -2
- package/dist/types-ts4.5/types/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/TypeAheadErrorFallback/EmptyState.d.ts +9 -0
- package/dist/types-ts4.5/ui/TypeAheadErrorFallback/GenericErrorSVG.d.ts +6 -0
- package/dist/types-ts4.5/ui/TypeAheadErrorFallback/MinHeightContainer.d.ts +9 -0
- package/dist/types-ts4.5/ui/TypeAheadErrorFallback/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/TypeAheadPopup.d.ts +2 -1
- package/package.json +7 -2
|
@@ -167,6 +167,8 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
167
167
|
requestAnimationFrame(function () {
|
|
168
168
|
var _listContainerRef$cur;
|
|
169
169
|
if ((_listContainerRef$cur = listContainerRef.current) !== null && _listContainerRef$cur !== void 0 && _listContainerRef$cur.firstChild) {
|
|
170
|
+
// Ignored via go/ees005
|
|
171
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
170
172
|
listContainerRef.current.firstChild.scrollTo(0, 0);
|
|
171
173
|
}
|
|
172
174
|
});
|
|
@@ -223,8 +225,12 @@ var TypeAheadListComponent = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
223
225
|
focusTargetElement();
|
|
224
226
|
}
|
|
225
227
|
};
|
|
228
|
+
// Ignored via go/ees005
|
|
229
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
226
230
|
element === null || element === void 0 || element.addEventListener('keydown', handleKeyDown);
|
|
227
231
|
return function () {
|
|
232
|
+
// Ignored via go/ees005
|
|
233
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
228
234
|
element === null || element === void 0 || element.removeEventListener('keydown', handleKeyDown);
|
|
229
235
|
};
|
|
230
236
|
}, [editorView.state, focusTargetElement, selectNextItem, selectPreviousItem, selectedIndex, onItemClick, items.length]);
|
|
@@ -13,11 +13,15 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
13
13
|
var isOpen = typeAheadState.decorationSet.find().length > 0;
|
|
14
14
|
var triggerHandler = typeAheadState.triggerHandler,
|
|
15
15
|
items = typeAheadState.items,
|
|
16
|
+
errorInfo = typeAheadState.errorInfo,
|
|
16
17
|
selectedIndex = typeAheadState.selectedIndex,
|
|
17
18
|
decorationElement = typeAheadState.decorationElement,
|
|
18
19
|
decorationSet = typeAheadState.decorationSet,
|
|
19
20
|
query = typeAheadState.query;
|
|
20
|
-
var _useItemInsert = useItemInsert(
|
|
21
|
+
var _useItemInsert = useItemInsert(
|
|
22
|
+
// Ignored via go/ees005
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
24
|
+
triggerHandler, editorView, items, api),
|
|
21
25
|
_useItemInsert2 = _slicedToArray(_useItemInsert, 3),
|
|
22
26
|
onItemInsert = _useItemInsert2[0],
|
|
23
27
|
onTextInsert = _useItemInsert2[1],
|
|
@@ -66,7 +70,7 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
66
70
|
return;
|
|
67
71
|
}
|
|
68
72
|
}, [isOpen, query, onItemMatch]);
|
|
69
|
-
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || items.length === 0) {
|
|
73
|
+
if (!isOpen || !triggerHandler || !(decorationElement instanceof HTMLElement) || items.length === 0 && !errorInfo) {
|
|
70
74
|
return null;
|
|
71
75
|
}
|
|
72
76
|
return /*#__PURE__*/React.createElement(TypeAheadPopup, {
|
|
@@ -77,6 +81,7 @@ export var TypeAheadMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
77
81
|
anchorElement: decorationElement,
|
|
78
82
|
triggerHandler: triggerHandler,
|
|
79
83
|
items: items,
|
|
84
|
+
errorInfo: errorInfo,
|
|
80
85
|
selectedIndex: selectedIndex,
|
|
81
86
|
setSelectedItem: setSelectedItem,
|
|
82
87
|
onItemInsert: insertItem,
|
|
@@ -15,6 +15,7 @@ import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
|
|
|
15
15
|
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
16
16
|
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
17
17
|
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../pm-plugins/constants';
|
|
18
|
+
import { TypeAheadErrorFallback } from './TypeAheadErrorFallback';
|
|
18
19
|
import { TypeAheadList } from './TypeAheadList';
|
|
19
20
|
var DEFAULT_TYPEAHEAD_MENU_HEIGHT = 380;
|
|
20
21
|
var DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW = 480;
|
|
@@ -50,6 +51,7 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
50
51
|
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
51
52
|
popupsScrollableElement = props.popupsScrollableElement,
|
|
52
53
|
items = props.items,
|
|
54
|
+
errorInfo = props.errorInfo,
|
|
53
55
|
selectedIndex = props.selectedIndex,
|
|
54
56
|
onItemInsert = props.onItemInsert,
|
|
55
57
|
isEmptyQuery = props.isEmptyQuery,
|
|
@@ -153,15 +155,25 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
153
155
|
}, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
|
|
154
156
|
var getFitHeightDebounced = rafSchedule(getFitHeight);
|
|
155
157
|
useLayoutEffect(function () {
|
|
158
|
+
// Ignored via go/ees005
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
156
160
|
var scrollableElement = popupsScrollableElement || findOverflowScrollParent(anchorElement);
|
|
157
161
|
getFitHeight();
|
|
162
|
+
// Ignored via go/ees005
|
|
163
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
158
164
|
window.addEventListener('resize', getFitHeightDebounced);
|
|
159
165
|
if (scrollableElement) {
|
|
166
|
+
// Ignored via go/ees005
|
|
167
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
160
168
|
scrollableElement.addEventListener('scroll', getFitHeightDebounced);
|
|
161
169
|
}
|
|
162
170
|
return function () {
|
|
171
|
+
// Ignored via go/ees005
|
|
172
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
163
173
|
window.removeEventListener('resize', getFitHeightDebounced);
|
|
164
174
|
if (scrollableElement) {
|
|
175
|
+
// Ignored via go/ees005
|
|
176
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
165
177
|
scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
|
|
166
178
|
}
|
|
167
179
|
};
|
|
@@ -187,8 +199,12 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
187
199
|
});
|
|
188
200
|
};
|
|
189
201
|
var element = ref.current;
|
|
202
|
+
// Ignored via go/ees005
|
|
203
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
190
204
|
element === null || element === void 0 || element.addEventListener('focusout', focusOut);
|
|
191
205
|
return function () {
|
|
206
|
+
// Ignored via go/ees005
|
|
207
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
192
208
|
element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
|
|
193
209
|
};
|
|
194
210
|
}, [ref, cancel]);
|
|
@@ -206,8 +222,12 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
206
222
|
}
|
|
207
223
|
};
|
|
208
224
|
var element = ref.current;
|
|
225
|
+
// Ignored via go/ees005
|
|
226
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
209
227
|
element === null || element === void 0 || element.addEventListener('keydown', escape);
|
|
210
228
|
return function () {
|
|
229
|
+
// Ignored via go/ees005
|
|
230
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
211
231
|
element === null || element === void 0 || element.removeEventListener('keydown', escape);
|
|
212
232
|
};
|
|
213
233
|
}, [ref, cancel]);
|
|
@@ -231,7 +251,7 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
231
251
|
,
|
|
232
252
|
className: TYPE_AHEAD_POPUP_CONTENT_CLASS,
|
|
233
253
|
ref: ref
|
|
234
|
-
}, jsx(Highlight, {
|
|
254
|
+
}, errorInfo ? jsx(TypeAheadErrorFallback, null) : jsx(React.Fragment, null, jsx(Highlight, {
|
|
235
255
|
state: editorView.state,
|
|
236
256
|
triggerHandler: triggerHandler
|
|
237
257
|
}), jsx(TypeAheadList, {
|
|
@@ -244,6 +264,6 @@ export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
|
244
264
|
triggerHandler: triggerHandler,
|
|
245
265
|
moreElementsInQuickInsertViewEnabled: moreElementsInQuickInsertViewEnabled,
|
|
246
266
|
api: api
|
|
247
|
-
})));
|
|
267
|
+
}))));
|
|
248
268
|
});
|
|
249
269
|
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -2,7 +2,7 @@ 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 { itemIsDisabled } from '../pm-plugins/item-is-disabled';
|
|
5
|
+
import { itemIsDisabled as _itemIsDisabled } from '../pm-plugins/item-is-disabled';
|
|
6
6
|
import { getPluginState, moveSelectedIndex, skipForwardToSafeItem } from '../pm-plugins/utils';
|
|
7
7
|
import { useItemInsert } from './hooks/use-item-insert';
|
|
8
8
|
import { useLoadItems } from './hooks/use-load-items';
|
|
@@ -69,10 +69,18 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
69
69
|
var insertSelectedItem = useCallback(function () {
|
|
70
70
|
var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : SelectItemMode.SELECTED;
|
|
71
71
|
var view = editorViewRef.current;
|
|
72
|
+
|
|
73
|
+
// Ignored via go/ees005
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
72
75
|
var _ref3 = getPluginState(view.state),
|
|
73
76
|
selectedIndex = _ref3.selectedIndex;
|
|
74
|
-
var safeSelectedIndex = skipForwardToSafeItem(
|
|
75
|
-
|
|
77
|
+
var safeSelectedIndex = skipForwardToSafeItem({
|
|
78
|
+
currentIndex: selectedIndex,
|
|
79
|
+
nextIndex: 1,
|
|
80
|
+
listSize: items.length,
|
|
81
|
+
itemIsDisabled: function itemIsDisabled(idx) {
|
|
82
|
+
return _itemIsDisabled(items[idx], api);
|
|
83
|
+
}
|
|
76
84
|
});
|
|
77
85
|
// If the only safe index is -1 then none are safe - do not insert item
|
|
78
86
|
if (safeSelectedIndex === -1) {
|
|
@@ -109,8 +117,11 @@ export var WrapperTypeAhead = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
109
117
|
if (closed) {
|
|
110
118
|
return null;
|
|
111
119
|
}
|
|
120
|
+
if (!triggerHandler) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
112
123
|
return /*#__PURE__*/React.createElement(InputQuery, {
|
|
113
|
-
triggerQueryPrefix: triggerHandler.trigger,
|
|
124
|
+
triggerQueryPrefix: triggerHandler === null || triggerHandler === void 0 ? void 0 : triggerHandler.trigger,
|
|
114
125
|
onQueryChange: setQuery,
|
|
115
126
|
onItemSelect: insertSelectedItem,
|
|
116
127
|
selectNextItem: selectNextItem,
|
|
@@ -25,7 +25,10 @@ var insertRawQuery = function insertRawQuery(_ref) {
|
|
|
25
25
|
view.focus();
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
export var useItemInsert = function useItemInsert(triggerHandler, editorView, items, api
|
|
28
|
+
export var useItemInsert = function useItemInsert(triggerHandler, editorView, items, api
|
|
29
|
+
// Ignored via go/ees005
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/max-params
|
|
31
|
+
) {
|
|
29
32
|
var editorViewRef = useRef(editorView);
|
|
30
33
|
var itemsRef = useRef(items);
|
|
31
34
|
var onTextInsert = useCallback(function (_ref2) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { updateListError } from '../../pm-plugins/commands/update-list-error';
|
|
3
5
|
import { updateListItem } from '../../pm-plugins/commands/update-list-items';
|
|
4
6
|
var EMPTY_LIST_ITEM = [];
|
|
5
7
|
export var useLoadItems = function useLoadItems(triggerHandler, editorView, query) {
|
|
@@ -28,6 +30,17 @@ export var useLoadItems = function useLoadItems(triggerHandler, editorView, quer
|
|
|
28
30
|
queueMicrotask(function () {
|
|
29
31
|
updateListItem(list)(view.state, view.dispatch);
|
|
30
32
|
});
|
|
33
|
+
}).catch(function (e) {
|
|
34
|
+
if (fg('platform_editor_offline_editing_ga')) {
|
|
35
|
+
if (e) {
|
|
36
|
+
if (componentIsMounted.current) {
|
|
37
|
+
setItems(EMPTY_LIST_ITEM);
|
|
38
|
+
}
|
|
39
|
+
queueMicrotask(function () {
|
|
40
|
+
updateListError(e)(view.state, view.dispatch);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
31
44
|
});
|
|
32
45
|
|
|
33
46
|
// ignore because EditorView is mutable but we don't want to
|
|
@@ -12,8 +12,18 @@ export declare const getTypeAheadHandler: (editorState: EditorState) => TypeAhea
|
|
|
12
12
|
export declare const getTypeAheadQuery: (editorState: EditorState) => string | undefined;
|
|
13
13
|
export declare const isTypeAheadAllowed: (state: EditorState) => boolean;
|
|
14
14
|
export declare const findHandler: (id: string, state: EditorState) => TypeAheadHandler | null;
|
|
15
|
-
export declare const skipForwardToSafeItem: (currentIndex
|
|
16
|
-
|
|
15
|
+
export declare const skipForwardToSafeItem: ({ currentIndex, nextIndex, listSize, itemIsDisabled, }: {
|
|
16
|
+
currentIndex: number;
|
|
17
|
+
nextIndex: number;
|
|
18
|
+
listSize: number;
|
|
19
|
+
itemIsDisabled: (idx: number) => boolean;
|
|
20
|
+
}) => number;
|
|
21
|
+
export declare const skipBackwardToSafeItem: ({ currentIndex, nextIndex, listSize, itemIsDisabled, }: {
|
|
22
|
+
currentIndex: number;
|
|
23
|
+
nextIndex: number;
|
|
24
|
+
listSize: number;
|
|
25
|
+
itemIsDisabled: (idx: number) => boolean;
|
|
26
|
+
}) => number;
|
|
17
27
|
export declare const findHandlerByTrigger: ({ trigger, editorState, }: {
|
|
18
28
|
trigger: string;
|
|
19
29
|
editorState: EditorState;
|
|
@@ -5,6 +5,10 @@ import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/ed
|
|
|
5
5
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
export type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { CloseSelectionOptions } from '../pm-plugins/constants';
|
|
8
|
+
export type TypeAheadError = 'FETCH_ERROR';
|
|
9
|
+
export type TypeAheadErrorInfo = {
|
|
10
|
+
error: TypeAheadError;
|
|
11
|
+
} | null;
|
|
8
12
|
export type OnSelectItem = (props: {
|
|
9
13
|
index: number;
|
|
10
14
|
item: TypeAheadItem;
|
|
@@ -26,6 +30,7 @@ export type TypeAheadPluginState = {
|
|
|
26
30
|
typeAheadHandlers: Array<TypeAheadHandler>;
|
|
27
31
|
query: string;
|
|
28
32
|
items: Array<TypeAheadItem>;
|
|
33
|
+
errorInfo: TypeAheadErrorInfo;
|
|
29
34
|
triggerHandler?: TypeAheadHandler;
|
|
30
35
|
selectedIndex: number;
|
|
31
36
|
stats: TypeAheadStatsSerializable | null;
|
|
@@ -79,5 +84,6 @@ export interface TypeAheadPluginSharedState {
|
|
|
79
84
|
decorationElement: HTMLElement | null;
|
|
80
85
|
triggerHandler?: TypeAheadHandler;
|
|
81
86
|
items: Array<TypeAheadItem>;
|
|
87
|
+
errorInfo: TypeAheadErrorInfo;
|
|
82
88
|
selectedIndex: number;
|
|
83
89
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type EmptyStateProps = {
|
|
3
|
+
header: string;
|
|
4
|
+
testId?: string;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
renderImage?: () => React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare const EmptyState: ({ testId, header, description, renderImage }: EmptyStateProps) => JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export declare const minHeightComponentStyles: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const MinHeightContainer: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
minHeight: string;
|
|
9
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -9,7 +9,7 @@ import type { ExtractInjectionAPI, TypeAheadItem, TypeAheadHandler } from '@atla
|
|
|
9
9
|
import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { CloseSelectionOptions } from '../pm-plugins/constants';
|
|
11
11
|
import type { TypeAheadPlugin } from '../typeAheadPluginType';
|
|
12
|
-
import type { OnSelectItem } from '../types';
|
|
12
|
+
import type { OnSelectItem, TypeAheadErrorInfo } from '../types';
|
|
13
13
|
type TypeAheadPopupProps = {
|
|
14
14
|
triggerHandler: TypeAheadHandler;
|
|
15
15
|
editorView: EditorView;
|
|
@@ -18,6 +18,7 @@ type TypeAheadPopupProps = {
|
|
|
18
18
|
popupsBoundariesElement?: HTMLElement;
|
|
19
19
|
popupsScrollableElement?: HTMLElement;
|
|
20
20
|
items: Array<TypeAheadItem>;
|
|
21
|
+
errorInfo: TypeAheadErrorInfo;
|
|
21
22
|
selectedIndex: number;
|
|
22
23
|
setSelectedItem: OnSelectItem;
|
|
23
24
|
decorationSet: DecorationSet;
|
|
@@ -12,8 +12,18 @@ export declare const getTypeAheadHandler: (editorState: EditorState) => TypeAhea
|
|
|
12
12
|
export declare const getTypeAheadQuery: (editorState: EditorState) => string | undefined;
|
|
13
13
|
export declare const isTypeAheadAllowed: (state: EditorState) => boolean;
|
|
14
14
|
export declare const findHandler: (id: string, state: EditorState) => TypeAheadHandler | null;
|
|
15
|
-
export declare const skipForwardToSafeItem: (currentIndex
|
|
16
|
-
|
|
15
|
+
export declare const skipForwardToSafeItem: ({ currentIndex, nextIndex, listSize, itemIsDisabled, }: {
|
|
16
|
+
currentIndex: number;
|
|
17
|
+
nextIndex: number;
|
|
18
|
+
listSize: number;
|
|
19
|
+
itemIsDisabled: (idx: number) => boolean;
|
|
20
|
+
}) => number;
|
|
21
|
+
export declare const skipBackwardToSafeItem: ({ currentIndex, nextIndex, listSize, itemIsDisabled, }: {
|
|
22
|
+
currentIndex: number;
|
|
23
|
+
nextIndex: number;
|
|
24
|
+
listSize: number;
|
|
25
|
+
itemIsDisabled: (idx: number) => boolean;
|
|
26
|
+
}) => number;
|
|
17
27
|
export declare const findHandlerByTrigger: ({ trigger, editorState, }: {
|
|
18
28
|
trigger: string;
|
|
19
29
|
editorState: EditorState;
|
|
@@ -5,6 +5,10 @@ import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/ed
|
|
|
5
5
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
export type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
7
7
|
import type { CloseSelectionOptions } from '../pm-plugins/constants';
|
|
8
|
+
export type TypeAheadError = 'FETCH_ERROR';
|
|
9
|
+
export type TypeAheadErrorInfo = {
|
|
10
|
+
error: TypeAheadError;
|
|
11
|
+
} | null;
|
|
8
12
|
export type OnSelectItem = (props: {
|
|
9
13
|
index: number;
|
|
10
14
|
item: TypeAheadItem;
|
|
@@ -26,6 +30,7 @@ export type TypeAheadPluginState = {
|
|
|
26
30
|
typeAheadHandlers: Array<TypeAheadHandler>;
|
|
27
31
|
query: string;
|
|
28
32
|
items: Array<TypeAheadItem>;
|
|
33
|
+
errorInfo: TypeAheadErrorInfo;
|
|
29
34
|
triggerHandler?: TypeAheadHandler;
|
|
30
35
|
selectedIndex: number;
|
|
31
36
|
stats: TypeAheadStatsSerializable | null;
|
|
@@ -79,5 +84,6 @@ export interface TypeAheadPluginSharedState {
|
|
|
79
84
|
decorationElement: HTMLElement | null;
|
|
80
85
|
triggerHandler?: TypeAheadHandler;
|
|
81
86
|
items: Array<TypeAheadItem>;
|
|
87
|
+
errorInfo: TypeAheadErrorInfo;
|
|
82
88
|
selectedIndex: number;
|
|
83
89
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type EmptyStateProps = {
|
|
3
|
+
header: string;
|
|
4
|
+
testId?: string;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
renderImage?: () => React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare const EmptyState: ({ testId, header, description, renderImage }: EmptyStateProps) => JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export declare const minHeightComponentStyles: import("@emotion/react").SerializedStyles;
|
|
7
|
+
export declare const MinHeightContainer: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
minHeight: string;
|
|
9
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -9,7 +9,7 @@ import type { ExtractInjectionAPI, TypeAheadItem, TypeAheadHandler } from '@atla
|
|
|
9
9
|
import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { CloseSelectionOptions } from '../pm-plugins/constants';
|
|
11
11
|
import type { TypeAheadPlugin } from '../typeAheadPluginType';
|
|
12
|
-
import type { OnSelectItem } from '../types';
|
|
12
|
+
import type { OnSelectItem, TypeAheadErrorInfo } from '../types';
|
|
13
13
|
type TypeAheadPopupProps = {
|
|
14
14
|
triggerHandler: TypeAheadHandler;
|
|
15
15
|
editorView: EditorView;
|
|
@@ -18,6 +18,7 @@ type TypeAheadPopupProps = {
|
|
|
18
18
|
popupsBoundariesElement?: HTMLElement;
|
|
19
19
|
popupsScrollableElement?: HTMLElement;
|
|
20
20
|
items: Array<TypeAheadItem>;
|
|
21
|
+
errorInfo: TypeAheadErrorInfo;
|
|
21
22
|
selectedIndex: number;
|
|
22
23
|
setSelectedItem: OnSelectItem;
|
|
23
24
|
decorationSet: DecorationSet;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.4",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,13 +32,15 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^
|
|
35
|
+
"@atlaskit/editor-common": "^98.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-connectivity": "^1.1.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
39
39
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
40
|
+
"@atlaskit/heading": "^4.0.0",
|
|
40
41
|
"@atlaskit/menu": "^2.13.0",
|
|
41
42
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
43
|
+
"@atlaskit/primitives": "^13.3.0",
|
|
42
44
|
"@atlaskit/prosemirror-input-rules": "^3.2.0",
|
|
43
45
|
"@atlaskit/theme": "^14.0.0",
|
|
44
46
|
"@atlaskit/tokens": "^2.5.0",
|
|
@@ -92,6 +94,9 @@
|
|
|
92
94
|
},
|
|
93
95
|
"platform_editor_react18_plugin_portalprovider": {
|
|
94
96
|
"type": "boolean"
|
|
97
|
+
},
|
|
98
|
+
"platform_editor_offline_editing_ga": {
|
|
99
|
+
"type": "boolean"
|
|
95
100
|
}
|
|
96
101
|
}
|
|
97
102
|
}
|