@atlaskit/editor-plugin-type-ahead 1.13.0 → 1.13.2
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 +17 -0
- package/dist/cjs/pm-plugins/decorations.js +9 -37
- package/dist/cjs/ui/ContentComponent.js +22 -7
- package/dist/cjs/ui/modern/TypeAheadMenu.js +77 -0
- package/dist/cjs/ui/modern/TypeAheadPopup.js +282 -0
- package/dist/es2019/pm-plugins/decorations.js +9 -37
- package/dist/es2019/ui/ContentComponent.js +21 -6
- package/dist/es2019/ui/modern/TypeAheadMenu.js +68 -0
- package/dist/es2019/ui/modern/TypeAheadPopup.js +275 -0
- package/dist/esm/pm-plugins/decorations.js +9 -37
- package/dist/esm/ui/ContentComponent.js +21 -6
- package/dist/esm/ui/modern/TypeAheadMenu.js +70 -0
- package/dist/esm/ui/modern/TypeAheadPopup.js +271 -0
- package/dist/types/ui/modern/TypeAheadMenu.d.ts +13 -0
- package/dist/types/ui/modern/TypeAheadPopup.d.ts +34 -0
- package/dist/types-ts4.5/ui/modern/TypeAheadMenu.d.ts +13 -0
- package/dist/types-ts4.5/ui/modern/TypeAheadPopup.d.ts +34 -0
- package/package.json +6 -7
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import rafSchedule from 'raf-schd';
|
|
11
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
12
|
+
import { findOverflowScrollParent, Popup } from '@atlaskit/editor-common/ui';
|
|
13
|
+
import { QuickInsertPanel } from '@atlaskit/editor-element-browser';
|
|
14
|
+
import { akEditorFloatingDialogZIndex } from '@atlaskit/editor-shared-styles';
|
|
15
|
+
import { Pressable, xcss } from '@atlaskit/primitives';
|
|
16
|
+
import { N0, N50A, N60A } from '@atlaskit/theme/colors';
|
|
17
|
+
import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_DATA_ATTRIBUTE, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../../pm-plugins/constants';
|
|
18
|
+
import { TypeAheadErrorFallback } from '../TypeAheadErrorFallback';
|
|
19
|
+
var DEFAULT_TYPEAHEAD_MENU_HEIGHT = 520;
|
|
20
|
+
// const DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW = 480;
|
|
21
|
+
|
|
22
|
+
var ITEM_PADDING = 12;
|
|
23
|
+
var typeAheadContent = css({
|
|
24
|
+
background: "var(--ds-surface-overlay, ".concat(N0, ")"),
|
|
25
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
26
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 1px ".concat(N60A, ", 0 4px 8px -2px ").concat(N50A), ")"),
|
|
27
|
+
padding: "var(--ds-space-050, 4px)".concat(" 0"),
|
|
28
|
+
width: '280px',
|
|
29
|
+
maxHeight: '520px' /* ~5.5 visibile items */,
|
|
30
|
+
overflowY: 'auto',
|
|
31
|
+
MsOverflowStyle: '-ms-autohiding-scrollbar',
|
|
32
|
+
position: 'relative'
|
|
33
|
+
});
|
|
34
|
+
// const typeAheadContentOverride = css({
|
|
35
|
+
// maxHeight: `${DEFAULT_TYPEAHEAD_MENU_HEIGHT_NEW}px`,
|
|
36
|
+
// });
|
|
37
|
+
|
|
38
|
+
var viewAllButtonStyles = xcss({
|
|
39
|
+
background: "var(--ds-background-input-pressed, #FFFFFF)",
|
|
40
|
+
position: 'sticky',
|
|
41
|
+
bottom: '-4px',
|
|
42
|
+
width: '100%',
|
|
43
|
+
height: '40px',
|
|
44
|
+
color: 'color.text.subtle',
|
|
45
|
+
fontWeight: "var(--ds-font-weight-medium, 500)",
|
|
46
|
+
':hover': {
|
|
47
|
+
textDecoration: 'underline'
|
|
48
|
+
},
|
|
49
|
+
':active': {
|
|
50
|
+
color: 'color.text'
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
var OFFSET = [0, 8];
|
|
54
|
+
export var TypeAheadPopup = /*#__PURE__*/React.memo(function (props) {
|
|
55
|
+
var triggerHandler = props.triggerHandler,
|
|
56
|
+
anchorElement = props.anchorElement,
|
|
57
|
+
popupsMountPoint = props.popupsMountPoint,
|
|
58
|
+
popupsBoundariesElement = props.popupsBoundariesElement,
|
|
59
|
+
popupsScrollableElement = props.popupsScrollableElement,
|
|
60
|
+
items = props.items,
|
|
61
|
+
errorInfo = props.errorInfo,
|
|
62
|
+
onItemInsert = props.onItemInsert,
|
|
63
|
+
isEmptyQuery = props.isEmptyQuery,
|
|
64
|
+
cancel = props.cancel,
|
|
65
|
+
api = props.api,
|
|
66
|
+
query = props.query;
|
|
67
|
+
var ref = useRef(null);
|
|
68
|
+
var defaultMenuHeight = DEFAULT_TYPEAHEAD_MENU_HEIGHT;
|
|
69
|
+
var startTime = useMemo(function () {
|
|
70
|
+
return performance.now();
|
|
71
|
+
},
|
|
72
|
+
// In case those props changes
|
|
73
|
+
// we need to recreate the startTime
|
|
74
|
+
[items, isEmptyQuery, triggerHandler] // eslint-disable-line react-hooks/exhaustive-deps
|
|
75
|
+
);
|
|
76
|
+
useEffect(function () {
|
|
77
|
+
var _api$analytics, _api$analytics2;
|
|
78
|
+
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)) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
var stopTime = performance.now();
|
|
82
|
+
var time = stopTime - startTime;
|
|
83
|
+
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({
|
|
84
|
+
action: ACTION.RENDERED,
|
|
85
|
+
actionSubject: ACTION_SUBJECT.TYPEAHEAD,
|
|
86
|
+
eventType: EVENT_TYPE.OPERATIONAL,
|
|
87
|
+
attributes: {
|
|
88
|
+
time: time,
|
|
89
|
+
items: items.length,
|
|
90
|
+
initial: isEmptyQuery
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}, [startTime, items, isEmptyQuery,
|
|
94
|
+
// In case the current triggerHandler changes
|
|
95
|
+
// e.g: Inserting a mention using the quick insert
|
|
96
|
+
// we need to send the event again
|
|
97
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
98
|
+
triggerHandler, api]);
|
|
99
|
+
|
|
100
|
+
// useEffect(() => {
|
|
101
|
+
// if (!api?.analytics?.actions?.fireAnalyticsEvent) {
|
|
102
|
+
// return;
|
|
103
|
+
// }
|
|
104
|
+
|
|
105
|
+
// api?.analytics?.actions?.fireAnalyticsEvent({
|
|
106
|
+
// action: ACTION.VIEWED,
|
|
107
|
+
// actionSubject: ACTION_SUBJECT.TYPEAHEAD_ITEM,
|
|
108
|
+
// eventType: EVENT_TYPE.OPERATIONAL,
|
|
109
|
+
// attributes: {
|
|
110
|
+
// index: selectedIndex,
|
|
111
|
+
// items: items.length,
|
|
112
|
+
// },
|
|
113
|
+
// });
|
|
114
|
+
// }, [
|
|
115
|
+
// items,
|
|
116
|
+
// api,
|
|
117
|
+
// selectedIndex,
|
|
118
|
+
// // In case the current triggerHandler changes
|
|
119
|
+
// // e.g: Inserting a mention using the quick insert
|
|
120
|
+
// // we need to send the event again
|
|
121
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
|
+
// triggerHandler,
|
|
123
|
+
// ]);
|
|
124
|
+
|
|
125
|
+
var _useState = useState(defaultMenuHeight),
|
|
126
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
127
|
+
fitHeight = _useState2[0],
|
|
128
|
+
setFitHeight = _useState2[1];
|
|
129
|
+
var getFitHeight = useCallback(function () {
|
|
130
|
+
if (!anchorElement || !popupsMountPoint) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
var target = anchorElement;
|
|
134
|
+
var _target$getBoundingCl = target.getBoundingClientRect(),
|
|
135
|
+
targetTop = _target$getBoundingCl.top,
|
|
136
|
+
targetHeight = _target$getBoundingCl.height;
|
|
137
|
+
var boundariesElement = popupsBoundariesElement || document.body;
|
|
138
|
+
var _boundariesElement$ge = boundariesElement.getBoundingClientRect(),
|
|
139
|
+
boundariesHeight = _boundariesElement$ge.height,
|
|
140
|
+
boundariesTop = _boundariesElement$ge.top;
|
|
141
|
+
|
|
142
|
+
// Calculating the space above and space below our decoration
|
|
143
|
+
var spaceAbove = targetTop - (boundariesTop - boundariesElement.scrollTop);
|
|
144
|
+
var spaceBelow = boundariesTop + boundariesHeight - (targetTop + targetHeight);
|
|
145
|
+
|
|
146
|
+
// Keep default height if more than enough space
|
|
147
|
+
if (spaceBelow >= defaultMenuHeight) {
|
|
148
|
+
return setFitHeight(defaultMenuHeight);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Determines whether typeahead will fit above or below decoration
|
|
152
|
+
// and return the space available.
|
|
153
|
+
var newFitHeight = spaceBelow >= spaceAbove ? spaceBelow : spaceAbove;
|
|
154
|
+
|
|
155
|
+
// Each typeahead item has some padding
|
|
156
|
+
// We want to leave some space at the top so first item
|
|
157
|
+
// is not partially cropped
|
|
158
|
+
var fitHeightWithSpace = newFitHeight - ITEM_PADDING * 2;
|
|
159
|
+
|
|
160
|
+
// Ensure typeahead height is max its default height
|
|
161
|
+
var minFitHeight = Math.min(defaultMenuHeight, fitHeightWithSpace);
|
|
162
|
+
return setFitHeight(minFitHeight);
|
|
163
|
+
}, [anchorElement, defaultMenuHeight, popupsBoundariesElement, popupsMountPoint]);
|
|
164
|
+
var getFitHeightDebounced = rafSchedule(getFitHeight);
|
|
165
|
+
useLayoutEffect(function () {
|
|
166
|
+
// Ignored via go/ees005
|
|
167
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
168
|
+
var scrollableElement = popupsScrollableElement || findOverflowScrollParent(anchorElement);
|
|
169
|
+
getFitHeight();
|
|
170
|
+
// Ignored via go/ees005
|
|
171
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
172
|
+
window.addEventListener('resize', getFitHeightDebounced);
|
|
173
|
+
if (scrollableElement) {
|
|
174
|
+
// Ignored via go/ees005
|
|
175
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
176
|
+
scrollableElement.addEventListener('scroll', getFitHeightDebounced);
|
|
177
|
+
}
|
|
178
|
+
return function () {
|
|
179
|
+
// Ignored via go/ees005
|
|
180
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
181
|
+
window.removeEventListener('resize', getFitHeightDebounced);
|
|
182
|
+
if (scrollableElement) {
|
|
183
|
+
// Ignored via go/ees005
|
|
184
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
185
|
+
scrollableElement.removeEventListener('scroll', getFitHeightDebounced);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}, [anchorElement, popupsScrollableElement, getFitHeightDebounced, getFitHeight]);
|
|
189
|
+
useLayoutEffect(function () {
|
|
190
|
+
var focusOut = function focusOut(event) {
|
|
191
|
+
var _window$getSelection;
|
|
192
|
+
var relatedTarget = event.relatedTarget;
|
|
193
|
+
|
|
194
|
+
// Given the user is changing the focus
|
|
195
|
+
// When the target is inside the TypeAhead Popup
|
|
196
|
+
// Then the popup should stay open
|
|
197
|
+
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, "\"]")))) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (!(((_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : _window$getSelection.type) === 'Range')) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
cancel({
|
|
204
|
+
addPrefixTrigger: true,
|
|
205
|
+
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
206
|
+
forceFocusOnEditor: false
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
var element = ref.current;
|
|
210
|
+
// Ignored via go/ees005
|
|
211
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
212
|
+
element === null || element === void 0 || element.addEventListener('focusout', focusOut);
|
|
213
|
+
return function () {
|
|
214
|
+
// Ignored via go/ees005
|
|
215
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
216
|
+
element === null || element === void 0 || element.removeEventListener('focusout', focusOut);
|
|
217
|
+
};
|
|
218
|
+
}, [ref, cancel]);
|
|
219
|
+
|
|
220
|
+
// ED-17443 When you press escape on typeahead panel, it should remove focus and close the panel
|
|
221
|
+
// This is the expected keyboard behaviour advised by the Accessibility team
|
|
222
|
+
useLayoutEffect(function () {
|
|
223
|
+
var escape = function escape(event) {
|
|
224
|
+
if (event.key === 'Escape') {
|
|
225
|
+
cancel({
|
|
226
|
+
addPrefixTrigger: true,
|
|
227
|
+
setSelectionAt: CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
228
|
+
forceFocusOnEditor: true
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
var element = ref.current;
|
|
233
|
+
// Ignored via go/ees005
|
|
234
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
235
|
+
element === null || element === void 0 || element.addEventListener('keydown', escape);
|
|
236
|
+
return function () {
|
|
237
|
+
// Ignored via go/ees005
|
|
238
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
239
|
+
element === null || element === void 0 || element.removeEventListener('keydown', escape);
|
|
240
|
+
};
|
|
241
|
+
}, [ref, cancel]);
|
|
242
|
+
return jsx(Popup, {
|
|
243
|
+
zIndex: akEditorFloatingDialogZIndex,
|
|
244
|
+
target: anchorElement,
|
|
245
|
+
mountTo: popupsMountPoint,
|
|
246
|
+
boundariesElement: popupsBoundariesElement,
|
|
247
|
+
scrollableElement: popupsScrollableElement,
|
|
248
|
+
fitHeight: fitHeight,
|
|
249
|
+
fitWidth: 280,
|
|
250
|
+
offset: OFFSET,
|
|
251
|
+
ariaLabel: null,
|
|
252
|
+
preventOverflow: true
|
|
253
|
+
}, jsx("div", {
|
|
254
|
+
css: [typeAheadContent]
|
|
255
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
256
|
+
,
|
|
257
|
+
tabIndex: 0
|
|
258
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
259
|
+
,
|
|
260
|
+
className: TYPE_AHEAD_POPUP_CONTENT_CLASS,
|
|
261
|
+
ref: ref
|
|
262
|
+
}, errorInfo ? jsx(TypeAheadErrorFallback, null) : jsx(React.Fragment, null, jsx(QuickInsertPanel, {
|
|
263
|
+
items: items,
|
|
264
|
+
onItemInsert: onItemInsert,
|
|
265
|
+
query: query
|
|
266
|
+
}), jsx(Pressable, {
|
|
267
|
+
xcss: viewAllButtonStyles
|
|
268
|
+
// onClick={() => api?.contextPanel?.actions.showPanel()}
|
|
269
|
+
}, "View all inserts"))));
|
|
270
|
+
});
|
|
271
|
+
TypeAheadPopup.displayName = 'TypeAheadPopup';
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
typeAheadState: TypeAheadPluginSharedState;
|
|
8
|
+
editorView: EditorView;
|
|
9
|
+
popupMountRef: PopupMountPointReference;
|
|
10
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, api }: TypeAheadMenuType) => React.JSX.Element | null>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
triggerHandler: TypeAheadHandler;
|
|
15
|
+
editorView: EditorView;
|
|
16
|
+
anchorElement: HTMLElement;
|
|
17
|
+
popupsMountPoint?: HTMLElement;
|
|
18
|
+
popupsBoundariesElement?: HTMLElement;
|
|
19
|
+
popupsScrollableElement?: HTMLElement;
|
|
20
|
+
items: Array<TypeAheadItem>;
|
|
21
|
+
errorInfo: TypeAheadErrorInfo;
|
|
22
|
+
decorationSet: DecorationSet;
|
|
23
|
+
isEmptyQuery: boolean;
|
|
24
|
+
query: string;
|
|
25
|
+
onItemInsert: (mode: SelectItemMode, index: number) => void;
|
|
26
|
+
cancel: (params: {
|
|
27
|
+
setSelectionAt: CloseSelectionOptions;
|
|
28
|
+
addPrefixTrigger: boolean;
|
|
29
|
+
forceFocusOnEditor: boolean;
|
|
30
|
+
}) => void;
|
|
31
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
32
|
+
};
|
|
33
|
+
export declare const TypeAheadPopup: React.MemoExoticComponent<(props: TypeAheadPopupProps) => jsx.JSX.Element>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
typeAheadState: TypeAheadPluginSharedState;
|
|
8
|
+
editorView: EditorView;
|
|
9
|
+
popupMountRef: PopupMountPointReference;
|
|
10
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, api }: TypeAheadMenuType) => React.JSX.Element | null>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
triggerHandler: TypeAheadHandler;
|
|
15
|
+
editorView: EditorView;
|
|
16
|
+
anchorElement: HTMLElement;
|
|
17
|
+
popupsMountPoint?: HTMLElement;
|
|
18
|
+
popupsBoundariesElement?: HTMLElement;
|
|
19
|
+
popupsScrollableElement?: HTMLElement;
|
|
20
|
+
items: Array<TypeAheadItem>;
|
|
21
|
+
errorInfo: TypeAheadErrorInfo;
|
|
22
|
+
decorationSet: DecorationSet;
|
|
23
|
+
isEmptyQuery: boolean;
|
|
24
|
+
query: string;
|
|
25
|
+
onItemInsert: (mode: SelectItemMode, index: number) => void;
|
|
26
|
+
cancel: (params: {
|
|
27
|
+
setSelectionAt: CloseSelectionOptions;
|
|
28
|
+
addPrefixTrigger: boolean;
|
|
29
|
+
forceFocusOnEditor: boolean;
|
|
30
|
+
}) => void;
|
|
31
|
+
api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
|
|
32
|
+
};
|
|
33
|
+
export declare const TypeAheadPopup: React.MemoExoticComponent<(props: TypeAheadPopupProps) => jsx.JSX.Element>;
|
|
34
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-type-ahead",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.2",
|
|
4
4
|
"description": "Type-ahead plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,10 +31,11 @@
|
|
|
31
31
|
".": "./src/index.ts"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atlaskit/adf-schema": "^
|
|
35
|
-
"@atlaskit/editor-common": "^99.
|
|
34
|
+
"@atlaskit/adf-schema": "^47.2.1",
|
|
35
|
+
"@atlaskit/editor-common": "^99.14.0",
|
|
36
|
+
"@atlaskit/editor-element-browser": "^0.0.1",
|
|
36
37
|
"@atlaskit/editor-plugin-analytics": "^1.12.0",
|
|
37
|
-
"@atlaskit/editor-plugin-connectivity": "^1.
|
|
38
|
+
"@atlaskit/editor-plugin-connectivity": "^1.3.0",
|
|
38
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
40
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
40
41
|
"@atlaskit/heading": "^4.1.0",
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
"@atlaskit/primitives": "^13.5.0",
|
|
44
45
|
"@atlaskit/prosemirror-input-rules": "^3.3.0",
|
|
45
46
|
"@atlaskit/theme": "^15.0.0",
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^2.46.0",
|
|
46
48
|
"@atlaskit/tokens": "^3.3.0",
|
|
47
49
|
"@babel/runtime": "^7.0.0",
|
|
48
50
|
"@emotion/react": "^11.7.1",
|
|
@@ -92,9 +94,6 @@
|
|
|
92
94
|
"platform_editor_react18_phase2_v2": {
|
|
93
95
|
"type": "boolean"
|
|
94
96
|
},
|
|
95
|
-
"platform_editor_react18_plugin_portalprovider": {
|
|
96
|
-
"type": "boolean"
|
|
97
|
-
},
|
|
98
97
|
"platform_editor_offline_editing_ga": {
|
|
99
98
|
"type": "boolean"
|
|
100
99
|
}
|