@atlaskit/editor-plugin-type-ahead 6.5.11 → 6.5.13
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 +15 -0
- package/dist/cjs/pm-plugins/decorations.js +4 -0
- package/dist/cjs/ui/ContentComponent.js +15 -36
- package/dist/cjs/ui/InputQuery.js +3 -4
- package/dist/cjs/ui/TypeAheadListItem.js +2 -2
- package/dist/es2019/pm-plugins/decorations.js +3 -0
- package/dist/es2019/ui/ContentComponent.js +14 -35
- package/dist/es2019/ui/InputQuery.js +3 -4
- package/dist/es2019/ui/TypeAheadListItem.js +2 -2
- package/dist/esm/pm-plugins/decorations.js +3 -0
- package/dist/esm/ui/ContentComponent.js +14 -35
- package/dist/esm/ui/InputQuery.js +3 -4
- package/dist/esm/ui/TypeAheadListItem.js +2 -2
- package/package.json +7 -7
- package/dist/cjs/ui/modern/TypeAheadMenu.js +0 -84
- package/dist/cjs/ui/modern/TypeAheadPopup.js +0 -321
- package/dist/es2019/ui/modern/TypeAheadMenu.js +0 -76
- package/dist/es2019/ui/modern/TypeAheadPopup.js +0 -315
- package/dist/esm/ui/modern/TypeAheadMenu.js +0 -77
- package/dist/esm/ui/modern/TypeAheadPopup.js +0 -312
- package/dist/types/ui/modern/TypeAheadMenu.d.ts +0 -13
- package/dist/types/ui/modern/TypeAheadPopup.d.ts +0 -37
- package/dist/types-ts4.5/ui/modern/TypeAheadMenu.d.ts +0 -13
- package/dist/types-ts4.5/ui/modern/TypeAheadPopup.d.ts +0 -37
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
/* eslint-disable @atlaskit/ui-styling-standard/use-compiled */
|
|
3
|
-
/**
|
|
4
|
-
* @jsxRuntime classic
|
|
5
|
-
* @jsx jsx
|
|
6
|
-
*/
|
|
7
|
-
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import rafSchedule from 'raf-schd';
|
|
10
|
-
import { useIntl } from 'react-intl-next';
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
|
-
|
|
14
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
15
|
-
import { elementInsertSidePanel } from '@atlaskit/editor-common/messages';
|
|
16
|
-
import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
|
|
17
|
-
import { SideInsertPanel, QuickInsertPanel } from '@atlaskit/editor-element-browser';
|
|
18
|
-
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
19
|
-
import AddIcon from '@atlaskit/icon/core/add';
|
|
20
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
|
-
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
22
|
-
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../../pm-plugins/constants';
|
|
23
|
-
import { TypeAheadErrorFallback } from '../TypeAheadErrorFallback';
|
|
24
|
-
var DEFAULT_TYPEAHEAD_MENU_HEIGHT = 520;
|
|
25
|
-
// const DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW = 480;
|
|
26
|
-
|
|
27
|
-
var ITEM_PADDING = 12;
|
|
28
|
-
var INSERT_PANEL_WIDTH = 320;
|
|
29
|
-
var typeAheadContent = css({
|
|
30
|
-
background: "var(--ds-surface-overlay, ".concat(N0, ")"),
|
|
31
|
-
borderRadius: "var(--ds-radius-small, 3px)",
|
|
32
|
-
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 1px ".concat(N60A, ", 0 4px 8px -2px ").concat(N50A), ")"),
|
|
33
|
-
padding: "var(--ds-space-050, 4px)".concat(" 0"),
|
|
34
|
-
width: '280px',
|
|
35
|
-
maxHeight: '520px' /* ~5.5 visibile items */,
|
|
36
|
-
overflowY: 'auto',
|
|
37
|
-
MsOverflowStyle: '-ms-autohiding-scrollbar',
|
|
38
|
-
position: 'relative'
|
|
39
|
-
});
|
|
40
|
-
// const typeAheadContentOverride = css({
|
|
41
|
-
// maxHeight: `${DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW}px`,
|
|
42
|
-
// });
|
|
43
|
-
|
|
44
|
-
var OFFSET = [0, 8];
|
|
45
|
-
export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
46
|
-
var triggerHandler = props.triggerHandler,
|
|
47
|
-
anchorElement = props.anchorElement,
|
|
48
|
-
popupsMountPoint = props.popupsMountPoint,
|
|
49
|
-
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
50
|
-
popupsScrollableElement = props.popupsScrollableElement,
|
|
51
|
-
items = props.items,
|
|
52
|
-
errorInfo = props.errorInfo,
|
|
53
|
-
onItemInsert = props.onItemInsert,
|
|
54
|
-
isEmptyQuery = props.isEmptyQuery,
|
|
55
|
-
cancel = props.cancel,
|
|
56
|
-
api = props.api,
|
|
57
|
-
query = props.query,
|
|
58
|
-
setSelectedItem = props.setSelectedItem;
|
|
59
|
-
var ref = useRef(null);
|
|
60
|
-
var _useIntl = useIntl(),
|
|
61
|
-
formatMessage = _useIntl.formatMessage;
|
|
62
|
-
var defaultMenuHeight = DEFAULT_TYPEAHEAD_MENU_HEIGHT;
|
|
63
|
-
var startTime = useMemo(function () {
|
|
64
|
-
return performance.now();
|
|
65
|
-
},
|
|
66
|
-
// In case those props changes
|
|
67
|
-
// we need to recreate the startTime
|
|
68
|
-
[items, isEmptyQuery, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
|
|
69
|
-
);
|
|
70
|
-
useEffect(function () {
|
|
71
|
-
var _api$analytics, _api$analytics2;
|
|
72
|
-
if (!(api !== null && api !== void 0 && (_api$analytics = api.analytics) !== null && _api$analytics !== void 0 && (_api$analytics = _api$analytics.actions) !== null && _api$analytics !== void 0 && _api$analytics.fireAnalyticsEvent)) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
var stopTime = performance.now();
|
|
76
|
-
var time = stopTime - startTime;
|
|
77
|
-
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.fireAnalyticsEvent({
|
|
78
|
-
action: ACTION.RENDERED,
|
|
79
|
-
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
80
|
-
eventType: EVENT_TYPE.OPERATIONAL,
|
|
81
|
-
attributes: {
|
|
82
|
-
time: time,
|
|
83
|
-
items: items.length,
|
|
84
|
-
initial: isEmptyQuery
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}, [startTime, items, isEmptyQuery,
|
|
88
|
-
// In case the current triggerHandler changes
|
|
89
|
-
// e.g: Inserting a mention using the quick insert
|
|
90
|
-
// we need to send the event again
|
|
91
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
92
|
-
triggerHandler, api]);
|
|
93
|
-
|
|
94
|
-
// useEffect(() => {
|
|
95
|
-
// if (!api?.analytics?.actions?.fireAnalyticsEvent) {
|
|
96
|
-
// return;
|
|
97
|
-
// }
|
|
98
|
-
|
|
99
|
-
// api?.analytics?.actions?.fireAnalyticsEvent({
|
|
100
|
-
// action: ACTION.VIEWED,
|
|
101
|
-
// actionSubject: ACTION_SUBJECT.TYPEAHEAD_ITEM,
|
|
102
|
-
// eventType: EVENT_TYPE.OPERATIONAL,
|
|
103
|
-
// attributes: {
|
|
104
|
-
// index: selectedIndex,
|
|
105
|
-
// items: items.length,
|
|
106
|
-
// },
|
|
107
|
-
// });
|
|
108
|
-
// }, [
|
|
109
|
-
// items,
|
|
110
|
-
// api,
|
|
111
|
-
// selectedIndex,
|
|
112
|
-
// // In case the current triggerHandler changes
|
|
113
|
-
// // e.g: Inserting a mention using the quick insert
|
|
114
|
-
// // we need to send the event again
|
|
115
|
-
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
116
|
-
// triggerHandler,
|
|
117
|
-
// ]);
|
|
118
|
-
|
|
119
|
-
var _useState = useState(defaultMenuHeight),
|
|
120
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
121
|
-
fitHeight = _useState2[0],
|
|
122
|
-
setFitHeight = _useState2[1];
|
|
123
|
-
var getFitHeight = useCallback(function () {
|
|
124
|
-
if (!anchorElement || !popupsMountPoint) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
var target = anchorElement;
|
|
128
|
-
var _target$getBoundingCl = target.getBoundingClientRect(),
|
|
129
|
-
targetTop = _target$getBoundingCl.top,
|
|
130
|
-
targetHeight = _target$getBoundingCl.height;
|
|
131
|
-
var boundariesElement = popupsBoundariesElement || document.body;
|
|
132
|
-
var _boundariesElement$ge = boundariesElement.getBoundingClientRect(),
|
|
133
|
-
boundariesHeight = _boundariesElement$ge.height,
|
|
134
|
-
boundariesTop = _boundariesElement$ge.top;
|
|
135
|
-
|
|
136
|
-
// Calculating the space above and space below our decoration
|
|
137
|
-
var spaceAbove = targetTop - (boundariesTop - boundariesElement.scrollTop);
|
|
138
|
-
var spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight);
|
|
139
|
-
|
|
140
|
-
// Keep default height if more than enough space
|
|
141
|
-
if (spaceBelow >= defaultMenuHeight) {
|
|
142
|
-
return setFitHeight(defaultMenuHeight);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Determines whether typeahead will fit above or below decoration
|
|
146
|
-
// and return the space available.
|
|
147
|
-
var newFitHeight = spaceBelow >= spaceAbove ? spaceBelow : spaceAbove;
|
|
148
|
-
|
|
149
|
-
// Each typeahead item has some padding
|
|
150
|
-
// We want to leave some space at the top so first item
|
|
151
|
-
// is not partially cropped
|
|
152
|
-
var fitHeightWithSpace = newFitHeight - ITEM_PADDING * 2;
|
|
153
|
-
|
|
154
|
-
// Ensure typeahead height is max its default height
|
|
155
|
-
var minFitHeight = Math.min(defaultMenuHeight, fitHeightWithSpace);
|
|
156
|
-
return setFitHeight(minFitHeight);
|
|
157
|
-
}, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
|
|
158
|
-
var getFitHeightDebounced = rafSchedule(getFitHeight);
|
|
159
|
-
useLayoutEffect(function () {
|
|
160
|
-
// Ignored via go/ees005
|
|
161
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
162
|
-
var scrollableElement = popupsScrollableElement || findOverflowScrollParent(anchorElement);
|
|
163
|
-
getFitHeight();
|
|
164
|
-
// Ignored via go/ees005
|
|
165
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
166
|
-
window.addEventListener('resize', getFitHeightDebounced);
|
|
167
|
-
if (scrollableElement) {
|
|
168
|
-
// Ignored via go/ees005
|
|
169
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
170
|
-
scrollableElement.addEventListener('scroll', getFitHeightDebounced);
|
|
171
|
-
}
|
|
172
|
-
return function () {
|
|
173
|
-
// Ignored via go/ees005
|
|
174
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
175
|
-
window.removeEventListener('resize', getFitHeightDebounced);
|
|
176
|
-
if (scrollableElement) {
|
|
177
|
-
// Ignored via go/ees005
|
|
178
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
179
|
-
scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
}, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
|
|
183
|
-
useLayoutEffect(function () {
|
|
184
|
-
var focusOut = function focusOut(event) {
|
|
185
|
-
var _window$getSelection;
|
|
186
|
-
var relatedTarget = event.relatedTarget;
|
|
187
|
-
|
|
188
|
-
// Given the user is changing the focus
|
|
189
|
-
// When the target is inside the TypeAhead Popup
|
|
190
|
-
// Then the popup should stay open
|
|
191
|
-
if (relatedTarget instanceof HTMLElement && relatedTarget.closest && (relatedTarget.closest(".".concat(TYPE_AHEAD_POPUP_CONTENT_CLASS)) || relatedTarget.closest("[data-type-ahead=\"".concat(TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, "\"]")))) {
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// Handles cases like emoji and @ typeaheads that open new typeaheads
|
|
196
|
-
var isTextSelected = ((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range';
|
|
197
|
-
var innerEditor = anchorElement.closest('.extension-editable-area');
|
|
198
|
-
if (innerEditor) {
|
|
199
|
-
// When there is no related target, we default to not closing the popup
|
|
200
|
-
var newFocusInsideCurrentEditor = !relatedTarget;
|
|
201
|
-
if (relatedTarget instanceof HTMLElement) {
|
|
202
|
-
// check if the new focus is inside inner editor, keep popup opens
|
|
203
|
-
newFocusInsideCurrentEditor = innerEditor.contains(relatedTarget);
|
|
204
|
-
}
|
|
205
|
-
if (!isTextSelected && newFocusInsideCurrentEditor) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
} else {
|
|
209
|
-
// if the current focus in outer editor, keep the existing behaviour, do not close the pop up if text is not selected
|
|
210
|
-
if (!isTextSelected) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
cancel({
|
|
215
|
-
addPrefixTrigger: true,
|
|
216
|
-
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
217
|
-
forceFocusOnEditor: false
|
|
218
|
-
});
|
|
219
|
-
};
|
|
220
|
-
var element = ref.current;
|
|
221
|
-
// Ignored via go/ees005
|
|
222
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
223
|
-
element === null || element === void 0 || element.addEventListener('focusout', focusOut);
|
|
224
|
-
return function () {
|
|
225
|
-
// Ignored via go/ees005
|
|
226
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
227
|
-
element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
|
|
228
|
-
};
|
|
229
|
-
}, [ref, cancel, anchorElement]);
|
|
230
|
-
|
|
231
|
-
// TODO: ED-17443 - When you press escape on typeahead panel, it should remove focus and close the panel
|
|
232
|
-
// This is the expected keyboard behaviour advised by the Accessibility team
|
|
233
|
-
useLayoutEffect(function () {
|
|
234
|
-
var escape = function escape(event) {
|
|
235
|
-
if (event.key === 'Escape') {
|
|
236
|
-
cancel({
|
|
237
|
-
addPrefixTrigger: true,
|
|
238
|
-
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
239
|
-
forceFocusOnEditor: true
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
var element = ref.current;
|
|
244
|
-
// Ignored via go/ees005
|
|
245
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
246
|
-
element === null || element === void 0 || element.addEventListener('keydown', escape);
|
|
247
|
-
return function () {
|
|
248
|
-
// Ignored via go/ees005
|
|
249
|
-
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
250
|
-
element === null || element === void 0 || element.removeEventListener('keydown', escape);
|
|
251
|
-
};
|
|
252
|
-
}, [ref, cancel]);
|
|
253
|
-
var handleViewAllItemsClick = useCallback(function () {
|
|
254
|
-
var _api$contextPanel;
|
|
255
|
-
var showContextPanel = api === null || api === void 0 || (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 || (_api$contextPanel = _api$contextPanel.actions) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.showPanel;
|
|
256
|
-
if (!showContextPanel || !items) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// Opens main editor controls side panel
|
|
261
|
-
showContextPanel({
|
|
262
|
-
id: 'editor-element-insert-sidebar-panel',
|
|
263
|
-
headerComponentElements: {
|
|
264
|
-
headerLabel: elementInsertSidePanel.title,
|
|
265
|
-
HeaderIcon: function HeaderIcon() {
|
|
266
|
-
return jsx(AddIcon, {
|
|
267
|
-
label: formatMessage(elementInsertSidePanel.title)
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
},
|
|
271
|
-
BodyComponent: function BodyComponent() {
|
|
272
|
-
return jsx(SideInsertPanel, {
|
|
273
|
-
items: items,
|
|
274
|
-
onItemInsert: onItemInsert
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
}, 'push', INSERT_PANEL_WIDTH);
|
|
278
|
-
|
|
279
|
-
// Closes typeahead
|
|
280
|
-
cancel({
|
|
281
|
-
addPrefixTrigger: true,
|
|
282
|
-
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
283
|
-
forceFocusOnEditor: true
|
|
284
|
-
});
|
|
285
|
-
}, [api, cancel, formatMessage, items, onItemInsert]);
|
|
286
|
-
return jsx(Popup, {
|
|
287
|
-
zIndex: akEditorFloatingDialogZIndex,
|
|
288
|
-
target: anchorElement,
|
|
289
|
-
mountTo: popupsMountPoint,
|
|
290
|
-
boundariesElement: popupsBoundariesElement,
|
|
291
|
-
scrollableElement: popupsScrollableElement,
|
|
292
|
-
fitHeight: fitHeight,
|
|
293
|
-
fitWidth: 280,
|
|
294
|
-
offset: OFFSET,
|
|
295
|
-
ariaLabel: null,
|
|
296
|
-
preventOverflow: true
|
|
297
|
-
}, jsx("div", {
|
|
298
|
-
css: [typeAheadContent],
|
|
299
|
-
tabIndex: fg('platform_editor_a11y_fix_typeahead_tabindex') ? undefined : 0
|
|
300
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
301
|
-
,
|
|
302
|
-
className: TYPE_AHEAD_POPUP_CONTENT_CLASS,
|
|
303
|
-
ref: ref
|
|
304
|
-
}, errorInfo ? jsx(TypeAheadErrorFallback, null) : jsx(React.Fragment, null, jsx(QuickInsertPanel, {
|
|
305
|
-
items: items,
|
|
306
|
-
onItemInsert: onItemInsert,
|
|
307
|
-
query: query,
|
|
308
|
-
setSelectedItem: setSelectedItem,
|
|
309
|
-
onViewAllItemsClick: Boolean(api === null || api === void 0 ? void 0 : api.contextPanel) ? handleViewAllItemsClick : undefined
|
|
310
|
-
}))));
|
|
311
|
-
});
|
|
312
|
-
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
5
|
-
import type { PopupMountPointReference, TypeAheadPluginSharedState } from '../../types';
|
|
6
|
-
type TypeAheadMenuType = {
|
|
7
|
-
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
8
|
-
editorView: EditorView;
|
|
9
|
-
popupMountRef: PopupMountPointReference;
|
|
10
|
-
typeAheadState: Omit<TypeAheadPluginSharedState, 'isOpen' | 'isAllowed' | 'selectedIndex'>;
|
|
11
|
-
};
|
|
12
|
-
export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, api }: TypeAheadMenuType) => React.JSX.Element | null>;
|
|
13
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
8
|
-
import type { ExtractInjectionAPI, TypeAheadItem, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
9
|
-
import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
-
import { CloseSelectionOptions } from '../../pm-plugins/constants';
|
|
11
|
-
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
12
|
-
import type { TypeAheadErrorInfo } from '../../types';
|
|
13
|
-
type TypeAheadPopupProps = {
|
|
14
|
-
anchorElement: HTMLElement;
|
|
15
|
-
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
16
|
-
cancel: (params: {
|
|
17
|
-
addPrefixTrigger: boolean;
|
|
18
|
-
forceFocusOnEditor: boolean;
|
|
19
|
-
setSelectionAt: CloseSelectionOptions;
|
|
20
|
-
}) => void;
|
|
21
|
-
decorationSet: DecorationSet;
|
|
22
|
-
editorView: EditorView;
|
|
23
|
-
errorInfo: TypeAheadErrorInfo;
|
|
24
|
-
isEmptyQuery: boolean;
|
|
25
|
-
items: Array<TypeAheadItem>;
|
|
26
|
-
onItemInsert: (mode: SelectItemMode, index: number) => void;
|
|
27
|
-
popupsBoundariesElement?: HTMLElement;
|
|
28
|
-
popupsMountPoint?: HTMLElement;
|
|
29
|
-
popupsScrollableElement?: HTMLElement;
|
|
30
|
-
query: string;
|
|
31
|
-
setSelectedItem?: (props: {
|
|
32
|
-
index: number;
|
|
33
|
-
}) => void;
|
|
34
|
-
triggerHandler: TypeAheadHandler;
|
|
35
|
-
};
|
|
36
|
-
export declare const TypeAheadPopup: React.MemoExoticComponent<(props: TypeAheadPopupProps) => jsx.JSX.Element>;
|
|
37
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
5
|
-
import type { PopupMountPointReference, TypeAheadPluginSharedState } from '../../types';
|
|
6
|
-
type TypeAheadMenuType = {
|
|
7
|
-
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
8
|
-
editorView: EditorView;
|
|
9
|
-
popupMountRef: PopupMountPointReference;
|
|
10
|
-
typeAheadState: Omit<TypeAheadPluginSharedState, 'isOpen' | 'isAllowed' | 'selectedIndex'>;
|
|
11
|
-
};
|
|
12
|
-
export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, api }: TypeAheadMenuType) => React.JSX.Element | null>;
|
|
13
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
8
|
-
import type { ExtractInjectionAPI, TypeAheadItem, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
9
|
-
import type { DecorationSet, EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
-
import { CloseSelectionOptions } from '../../pm-plugins/constants';
|
|
11
|
-
import type { TypeAheadPlugin } from '../../typeAheadPluginType';
|
|
12
|
-
import type { TypeAheadErrorInfo } from '../../types';
|
|
13
|
-
type TypeAheadPopupProps = {
|
|
14
|
-
anchorElement: HTMLElement;
|
|
15
|
-
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
16
|
-
cancel: (params: {
|
|
17
|
-
addPrefixTrigger: boolean;
|
|
18
|
-
forceFocusOnEditor: boolean;
|
|
19
|
-
setSelectionAt: CloseSelectionOptions;
|
|
20
|
-
}) => void;
|
|
21
|
-
decorationSet: DecorationSet;
|
|
22
|
-
editorView: EditorView;
|
|
23
|
-
errorInfo: TypeAheadErrorInfo;
|
|
24
|
-
isEmptyQuery: boolean;
|
|
25
|
-
items: Array<TypeAheadItem>;
|
|
26
|
-
onItemInsert: (mode: SelectItemMode, index: number) => void;
|
|
27
|
-
popupsBoundariesElement?: HTMLElement;
|
|
28
|
-
popupsMountPoint?: HTMLElement;
|
|
29
|
-
popupsScrollableElement?: HTMLElement;
|
|
30
|
-
query: string;
|
|
31
|
-
setSelectedItem?: (props: {
|
|
32
|
-
index: number;
|
|
33
|
-
}) => void;
|
|
34
|
-
triggerHandler: TypeAheadHandler;
|
|
35
|
-
};
|
|
36
|
-
export declare const TypeAheadPopup: React.MemoExoticComponent<(props: TypeAheadPopupProps) => jsx.JSX.Element>;
|
|
37
|
-
export {};
|