@atlaskit/editor-plugin-type-ahead 3.1.9 → 3.1.11

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/ui/InputQuery.js +30 -0
  3. package/dist/es2019/ui/InputQuery.js +30 -0
  4. package/dist/esm/ui/InputQuery.js +30 -0
  5. package/dist/types/pm-plugins/api.d.ts +1 -1
  6. package/dist/types/pm-plugins/commands/insert-type-ahead-item.d.ts +2 -2
  7. package/dist/types/pm-plugins/commands/insert-utils.d.ts +3 -3
  8. package/dist/types/pm-plugins/decorations.d.ts +2 -2
  9. package/dist/types/pm-plugins/main.d.ts +4 -4
  10. package/dist/types/pm-plugins/reducer.d.ts +1 -1
  11. package/dist/types/pm-plugins/stats-modifier.d.ts +1 -1
  12. package/dist/types/pm-plugins/utils.d.ts +8 -8
  13. package/dist/types/typeAheadPluginType.d.ts +13 -13
  14. package/dist/types/types/index.d.ts +19 -19
  15. package/dist/types/ui/InputQuery.d.ts +9 -9
  16. package/dist/types/ui/ListRow.d.ts +2 -2
  17. package/dist/types/ui/MoreOptions.d.ts +3 -3
  18. package/dist/types/ui/TypeAheadErrorFallback/EmptyState.d.ts +2 -2
  19. package/dist/types/ui/TypeAheadList.d.ts +14 -14
  20. package/dist/types/ui/TypeAheadListItem.d.ts +6 -6
  21. package/dist/types/ui/TypeAheadMenu.d.ts +2 -2
  22. package/dist/types/ui/TypeAheadPopup.d.ts +14 -14
  23. package/dist/types/ui/WrapperTypeAhead.d.ts +7 -7
  24. package/dist/types/ui/hooks/use-on-force-select.d.ts +3 -3
  25. package/dist/types/ui/modern/TypeAheadMenu.d.ts +2 -2
  26. package/dist/types/ui/modern/TypeAheadPopup.d.ts +13 -13
  27. package/dist/types-ts4.5/pm-plugins/api.d.ts +1 -1
  28. package/dist/types-ts4.5/pm-plugins/commands/insert-type-ahead-item.d.ts +2 -2
  29. package/dist/types-ts4.5/pm-plugins/commands/insert-utils.d.ts +3 -3
  30. package/dist/types-ts4.5/pm-plugins/decorations.d.ts +2 -2
  31. package/dist/types-ts4.5/pm-plugins/main.d.ts +4 -4
  32. package/dist/types-ts4.5/pm-plugins/reducer.d.ts +1 -1
  33. package/dist/types-ts4.5/pm-plugins/stats-modifier.d.ts +1 -1
  34. package/dist/types-ts4.5/pm-plugins/utils.d.ts +8 -8
  35. package/dist/types-ts4.5/typeAheadPluginType.d.ts +13 -13
  36. package/dist/types-ts4.5/types/index.d.ts +19 -19
  37. package/dist/types-ts4.5/ui/InputQuery.d.ts +9 -9
  38. package/dist/types-ts4.5/ui/ListRow.d.ts +2 -2
  39. package/dist/types-ts4.5/ui/MoreOptions.d.ts +3 -3
  40. package/dist/types-ts4.5/ui/TypeAheadErrorFallback/EmptyState.d.ts +2 -2
  41. package/dist/types-ts4.5/ui/TypeAheadList.d.ts +14 -14
  42. package/dist/types-ts4.5/ui/TypeAheadListItem.d.ts +6 -6
  43. package/dist/types-ts4.5/ui/TypeAheadMenu.d.ts +2 -2
  44. package/dist/types-ts4.5/ui/TypeAheadPopup.d.ts +14 -14
  45. package/dist/types-ts4.5/ui/WrapperTypeAhead.d.ts +7 -7
  46. package/dist/types-ts4.5/ui/hooks/use-on-force-select.d.ts +3 -3
  47. package/dist/types-ts4.5/ui/modern/TypeAheadMenu.d.ts +2 -2
  48. package/dist/types-ts4.5/ui/modern/TypeAheadPopup.d.ts +13 -13
  49. package/package.json +3 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 3.1.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2a8dcec064275`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2a8dcec064275) -
8
+ [ux] [ED-28449] add a paste event listener to insert plain text when user tries to paste rich text
9
+ into the typeahead
10
+ - Updated dependencies
11
+
12
+ ## 3.1.10
13
+
14
+ ### Patch Changes
15
+
16
+ - [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
17
+ Sorted type and interface props to improve Atlaskit docs
18
+ - Updated dependencies
19
+
3
20
  ## 3.1.9
4
21
 
5
22
  ### Patch Changes
@@ -17,6 +17,7 @@ var _ui = require("@atlaskit/editor-common/ui");
17
17
  var _utils = require("@atlaskit/editor-prosemirror/utils");
18
18
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
19
19
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
20
21
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
21
22
  var _constants = require("../pm-plugins/constants");
22
23
  var _utils2 = require("../pm-plugins/utils");
@@ -285,6 +286,25 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
285
286
  }
286
287
  checkKeyEvent(event);
287
288
  };
289
+ var onPaste = function onPaste(event) {
290
+ var _event$clipboardData, _event$clipboardData2;
291
+ var html = (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.getData('text/html');
292
+ var plainText = (_event$clipboardData2 = event.clipboardData) === null || _event$clipboardData2 === void 0 ? void 0 : _event$clipboardData2.getData('text/plain');
293
+ if (html && plainText) {
294
+ event.preventDefault();
295
+
296
+ // insert the plain text into the type-ahead input field
297
+ var _selection = window.getSelection();
298
+ if (_selection && ref.current) {
299
+ if (_selection.rangeCount > 0) {
300
+ var range = _selection.getRangeAt(0);
301
+ range.deleteContents();
302
+ range.insertNode(document.createTextNode(plainText));
303
+ range.collapse(false);
304
+ }
305
+ }
306
+ }
307
+ };
288
308
  var onFocusOut = function onFocusOut(event) {
289
309
  var _window$getSelection;
290
310
  var relatedTarget = event.relatedTarget;
@@ -386,6 +406,11 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
386
406
  // Ignored via go/ees005
387
407
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
388
408
  element.addEventListener('beforeinput', beforeinput);
409
+ if ((0, _expValEquals.expValEquals)('platform_editor_paste_rich_text_bugfix', 'isEnabled', true)) {
410
+ // Ignored via go/ees005
411
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
412
+ element.addEventListener('paste', onPaste);
413
+ }
389
414
  return function () {
390
415
  // Ignored via go/ees005
391
416
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -399,6 +424,11 @@ var InputQuery = exports.InputQuery = /*#__PURE__*/_react.default.memo(function
399
424
  // Ignored via go/ees005
400
425
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
401
426
  element.removeEventListener('beforeinput', beforeinput);
427
+ if ((0, _expValEquals.expValEquals)('platform_editor_paste_rich_text_bugfix', 'isEnabled', true)) {
428
+ // Ignored via go/ees005
429
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
430
+ element.removeEventListener('paste', onPaste);
431
+ }
402
432
  if (_browser.browser.safari) {
403
433
  // Ignored via go/ees005
404
434
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -14,6 +14,7 @@ import { AssistiveText } from '@atlaskit/editor-common/ui';
14
14
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
15
15
  import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
16
16
  import { fg } from '@atlaskit/platform-feature-flags';
17
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
17
18
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
18
19
  import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_ELEMENT_ID, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../pm-plugins/constants';
19
20
  import { getPluginState } from '../pm-plugins/utils';
@@ -272,6 +273,25 @@ export const InputQuery = /*#__PURE__*/React.memo(({
272
273
  }
273
274
  checkKeyEvent(event);
274
275
  };
276
+ const onPaste = event => {
277
+ var _event$clipboardData, _event$clipboardData2;
278
+ const html = (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.getData('text/html');
279
+ const plainText = (_event$clipboardData2 = event.clipboardData) === null || _event$clipboardData2 === void 0 ? void 0 : _event$clipboardData2.getData('text/plain');
280
+ if (html && plainText) {
281
+ event.preventDefault();
282
+
283
+ // insert the plain text into the type-ahead input field
284
+ const selection = window.getSelection();
285
+ if (selection && ref.current) {
286
+ if (selection.rangeCount > 0) {
287
+ const range = selection.getRangeAt(0);
288
+ range.deleteContents();
289
+ range.insertNode(document.createTextNode(plainText));
290
+ range.collapse(false);
291
+ }
292
+ }
293
+ }
294
+ };
275
295
  const onFocusOut = event => {
276
296
  var _window$getSelection;
277
297
  const {
@@ -379,6 +399,11 @@ export const InputQuery = /*#__PURE__*/React.memo(({
379
399
  // Ignored via go/ees005
380
400
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
381
401
  element.addEventListener('beforeinput', beforeinput);
402
+ if (expValEquals('platform_editor_paste_rich_text_bugfix', 'isEnabled', true)) {
403
+ // Ignored via go/ees005
404
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
405
+ element.addEventListener('paste', onPaste);
406
+ }
382
407
  return () => {
383
408
  // Ignored via go/ees005
384
409
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -392,6 +417,11 @@ export const InputQuery = /*#__PURE__*/React.memo(({
392
417
  // Ignored via go/ees005
393
418
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
394
419
  element.removeEventListener('beforeinput', beforeinput);
420
+ if (expValEquals('platform_editor_paste_rich_text_bugfix', 'isEnabled', true)) {
421
+ // Ignored via go/ees005
422
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
423
+ element.removeEventListener('paste', onPaste);
424
+ }
395
425
  if (browser.safari) {
396
426
  // Ignored via go/ees005
397
427
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -15,6 +15,7 @@ import { AssistiveText } from '@atlaskit/editor-common/ui';
15
15
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
16
16
  import { blockNodesVerticalMargin } from '@atlaskit/editor-shared-styles';
17
17
  import { fg } from '@atlaskit/platform-feature-flags';
18
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
19
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
19
20
  import { CloseSelectionOptions, TYPE_AHEAD_DECORATION_ELEMENT_ID, TYPE_AHEAD_POPUP_CONTENT_CLASS } from '../pm-plugins/constants';
20
21
  import { getPluginState } from '../pm-plugins/utils';
@@ -275,6 +276,25 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
275
276
  }
276
277
  checkKeyEvent(event);
277
278
  };
279
+ var onPaste = function onPaste(event) {
280
+ var _event$clipboardData, _event$clipboardData2;
281
+ var html = (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.getData('text/html');
282
+ var plainText = (_event$clipboardData2 = event.clipboardData) === null || _event$clipboardData2 === void 0 ? void 0 : _event$clipboardData2.getData('text/plain');
283
+ if (html && plainText) {
284
+ event.preventDefault();
285
+
286
+ // insert the plain text into the type-ahead input field
287
+ var _selection = window.getSelection();
288
+ if (_selection && ref.current) {
289
+ if (_selection.rangeCount > 0) {
290
+ var range = _selection.getRangeAt(0);
291
+ range.deleteContents();
292
+ range.insertNode(document.createTextNode(plainText));
293
+ range.collapse(false);
294
+ }
295
+ }
296
+ }
297
+ };
278
298
  var onFocusOut = function onFocusOut(event) {
279
299
  var _window$getSelection;
280
300
  var relatedTarget = event.relatedTarget;
@@ -376,6 +396,11 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
376
396
  // Ignored via go/ees005
377
397
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
378
398
  element.addEventListener('beforeinput', beforeinput);
399
+ if (expValEquals('platform_editor_paste_rich_text_bugfix', 'isEnabled', true)) {
400
+ // Ignored via go/ees005
401
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
402
+ element.addEventListener('paste', onPaste);
403
+ }
379
404
  return function () {
380
405
  // Ignored via go/ees005
381
406
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -389,6 +414,11 @@ export var InputQuery = /*#__PURE__*/React.memo(function (_ref) {
389
414
  // Ignored via go/ees005
390
415
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
391
416
  element.removeEventListener('beforeinput', beforeinput);
417
+ if (expValEquals('platform_editor_paste_rich_text_bugfix', 'isEnabled', true)) {
418
+ // Ignored via go/ees005
419
+ // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
420
+ element.removeEventListener('paste', onPaste);
421
+ }
392
422
  if (browser.safari) {
393
423
  // Ignored via go/ees005
394
424
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
@@ -4,8 +4,8 @@ import type { Command } from '@atlaskit/editor-common/types';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
6
6
  type CloseOptions = {
7
- insertCurrentQueryAsRawText: boolean;
8
7
  attachCommand?: Command;
8
+ insertCurrentQueryAsRawText: boolean;
9
9
  };
10
10
  type InsertItemProps = {
11
11
  contentItem: TypeAheadItem;
@@ -2,11 +2,11 @@ import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
2
2
  import type { TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  type Props = {
5
- item: TypeAheadItem;
6
5
  handler: TypeAheadHandler;
6
+ item: TypeAheadItem;
7
7
  mode: SelectItemMode;
8
- sourceListItem: Array<TypeAheadItem>;
9
8
  query: string;
9
+ sourceListItem: Array<TypeAheadItem>;
10
10
  };
11
11
  export declare const insertTypeAheadItem: (view: EditorView) => ({ item, handler, mode, query, sourceListItem }: Props) => void;
12
12
  export {};
@@ -1,18 +1,18 @@
1
1
  import { Fragment, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
3
  type Position = {
4
- start: number;
5
4
  end: number;
5
+ start: number;
6
6
  };
7
7
  export declare const insertBlockNode: ({ node, tr, position, }: {
8
8
  node: PMNode;
9
- tr: Transaction;
10
9
  position: Position;
10
+ tr: Transaction;
11
11
  }) => Transaction;
12
12
  export declare const insertInlineNodeOrFragment: ({ maybeFragment, tr, position, selectInlineNode, }: {
13
13
  maybeFragment: Fragment | PMNode;
14
- tr: Transaction;
15
14
  position: Position;
16
15
  selectInlineNode: boolean;
16
+ tr: Transaction;
17
17
  }) => Transaction;
18
18
  export {};
@@ -4,10 +4,10 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
4
  import type { TypeAheadPlugin } from '../typeAheadPluginType';
5
5
  import type { CreateTypeAheadDecorations, PopupMountPointReference, RemoveTypeAheadDecorations } from '../types';
6
6
  type FactoryProps = {
7
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
7
8
  intl: IntlShape;
8
- popupMountRef: PopupMountPointReference;
9
9
  nodeViewPortalProviderAPI: PortalProviderAPI;
10
- api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
10
+ popupMountRef: PopupMountPointReference;
11
11
  };
12
12
  type FactoryReturn = {
13
13
  createDecorations: CreateTypeAheadDecorations;
@@ -6,12 +6,12 @@ import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
6
6
  import { type TypeAheadPlugin } from '../typeAheadPluginType';
7
7
  import type { PopupMountPointReference, TypeAheadHandler } from '../types';
8
8
  type Props = {
9
- reactDispatch: Dispatch;
10
- popupMountRef: PopupMountPointReference;
11
- typeAheadHandlers: Array<TypeAheadHandler>;
9
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
12
10
  getIntl: () => IntlShape;
13
11
  nodeViewPortalProviderAPI: PortalProviderAPI;
14
- api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
12
+ popupMountRef: PopupMountPointReference;
13
+ reactDispatch: Dispatch;
14
+ typeAheadHandlers: Array<TypeAheadHandler>;
15
15
  };
16
16
  export declare function createPlugin({ reactDispatch, popupMountRef, typeAheadHandlers, getIntl, nodeViewPortalProviderAPI, api, }: Props): SafePlugin;
17
17
  export {};
@@ -2,8 +2,8 @@ import { InsertTypeAheadStep } from '@atlaskit/adf-schema/steps';
2
2
  import type { ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
3
3
  import type { CreateTypeAheadDecorations, PopupMountPointReference, RemoveTypeAheadDecorations, TypeAheadHandler, TypeAheadPluginState } from '../types';
4
4
  export type ReducerOptions = {
5
- popupMountRef: PopupMountPointReference;
6
5
  createDecorations: CreateTypeAheadDecorations;
6
+ popupMountRef: PopupMountPointReference;
7
7
  removeDecorations: RemoveTypeAheadDecorations;
8
8
  typeAheadHandlers: Array<TypeAheadHandler>;
9
9
  };
@@ -3,8 +3,8 @@ export declare class StatsModifier implements TypeAheadStatsModifier {
3
3
  startedAt: number;
4
4
  endedAt: number;
5
5
  keyCount: {
6
- arrowUp: number;
7
6
  arrowDown: number;
7
+ arrowUp: number;
8
8
  };
9
9
  constructor();
10
10
  increaseArrowUp: () => void;
@@ -14,29 +14,29 @@ export declare const isTypeAheadAllowed: (state: EditorState) => boolean;
14
14
  export declare const findHandler: (id: string, state: EditorState) => TypeAheadHandler | null;
15
15
  export declare const skipForwardToSafeItem: ({ currentIndex, nextIndex, listSize, itemIsDisabled, }: {
16
16
  currentIndex: number;
17
- nextIndex: number;
18
- listSize: number;
19
17
  itemIsDisabled: (idx: number) => boolean;
18
+ listSize: number;
19
+ nextIndex: number;
20
20
  }) => number;
21
21
  export declare const skipBackwardToSafeItem: ({ currentIndex, nextIndex, listSize, itemIsDisabled, }: {
22
22
  currentIndex: number;
23
- nextIndex: number;
24
- listSize: number;
25
23
  itemIsDisabled: (idx: number) => boolean;
24
+ listSize: number;
25
+ nextIndex: number;
26
26
  }) => number;
27
27
  export declare const findHandlerByTrigger: ({ trigger, editorState, }: {
28
- trigger: string;
29
28
  editorState: EditorState;
29
+ trigger: string;
30
30
  }) => TypeAheadHandler | null;
31
31
  type MoveSelectedIndexProps = {
32
- editorView: EditorView;
33
- direction: 'next' | 'previous';
34
32
  api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
33
+ direction: 'next' | 'previous';
34
+ editorView: EditorView;
35
35
  };
36
36
  export declare const moveSelectedIndex: ({ editorView, direction, api }: MoveSelectedIndexProps) => () => void;
37
37
  type TypeAheadAssistiveLabels = {
38
- popupAriaLabel: string;
39
38
  listItemAriaLabel?: string;
39
+ popupAriaLabel: string;
40
40
  };
41
41
  export declare const getTypeAheadListAriaLabels: (trigger: string | undefined, intl: IntlShape, item?: TypeAheadItem) => TypeAheadAssistiveLabels;
42
42
  export {};
@@ -8,22 +8,30 @@ import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
8
8
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
9
9
  import { type TypeAheadPluginOptions, type TypeAheadPluginSharedState, type OpenTypeAheadProps } from './types';
10
10
  type InsertTypeAheadItemProps = {
11
- triggerHandler: TypeAheadHandler;
12
11
  contentItem: TypeAheadItem;
12
+ mode?: SelectItemMode;
13
13
  query: string;
14
14
  sourceListItem: TypeAheadItem[];
15
- mode?: SelectItemMode;
15
+ triggerHandler: TypeAheadHandler;
16
16
  };
17
17
  type CloseTypeAheadProps = {
18
- insertCurrentQueryAsRawText: boolean;
19
18
  attachCommand?: Command;
19
+ insertCurrentQueryAsRawText: boolean;
20
20
  };
21
21
  /**
22
22
  * Type ahead plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
23
23
  * from `@atlaskit/editor-core`.
24
24
  */
25
25
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
26
- pluginConfiguration: TypeAheadPluginOptions | undefined;
26
+ actions: {
27
+ close: (props: CloseTypeAheadProps) => boolean;
28
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
29
+ insert: (props: InsertTypeAheadItemProps) => boolean;
30
+ isAllowed: (editorState: EditorState) => boolean;
31
+ isOpen: (editorState: EditorState) => boolean;
32
+ open: (props: OpenTypeAheadProps) => boolean;
33
+ openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
34
+ };
27
35
  dependencies: [
28
36
  OptionalPlugin<AnalyticsPlugin>,
29
37
  OptionalPlugin<FeatureFlagsPlugin>,
@@ -31,15 +39,7 @@ export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
31
39
  OptionalPlugin<ContextPanelPlugin>,
32
40
  OptionalPlugin<MetricsPlugin>
33
41
  ];
42
+ pluginConfiguration: TypeAheadPluginOptions | undefined;
34
43
  sharedState: TypeAheadPluginSharedState;
35
- actions: {
36
- isOpen: (editorState: EditorState) => boolean;
37
- isAllowed: (editorState: EditorState) => boolean;
38
- insert: (props: InsertTypeAheadItemProps) => boolean;
39
- findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
40
- open: (props: OpenTypeAheadProps) => boolean;
41
- close: (props: CloseTypeAheadProps) => boolean;
42
- openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
43
- };
44
44
  }>;
45
45
  export {};
@@ -17,32 +17,32 @@ export interface TypeAheadStatsSerializable extends TypeAheadStats {
17
17
  serialize: () => TypeAheadStats;
18
18
  }
19
19
  export interface TypeAheadStatsModifier extends TypeAheadStatsSerializable {
20
- increaseArrowUp: () => void;
21
20
  increaseArrowDown: () => void;
21
+ increaseArrowUp: () => void;
22
22
  }
23
23
  export interface TypeAheadStatsMobileModifier extends TypeAheadStatsSerializable {
24
- resetTime: () => void;
25
24
  closeTime: () => void;
25
+ resetTime: () => void;
26
26
  }
27
27
  export type TypeAheadPluginState = {
28
- decorationSet: DecorationSet;
29
28
  decorationElement: HTMLElement | null;
30
- typeAheadHandlers: Array<TypeAheadHandler>;
31
- query: string;
32
- items: Array<TypeAheadItem>;
29
+ decorationSet: DecorationSet;
33
30
  errorInfo: TypeAheadErrorInfo;
34
- triggerHandler?: TypeAheadHandler;
35
- selectedIndex: number;
36
- stats: TypeAheadStatsSerializable | null;
37
31
  inputMethod: TypeAheadInputMethod | null;
32
+ items: Array<TypeAheadItem>;
33
+ query: string;
38
34
  /**
39
35
  * If true, removes the trigger character from query when typeahead is closed
40
36
  */
41
37
  removePrefixTriggerOnCancel?: boolean;
38
+ selectedIndex: number;
39
+ stats: TypeAheadStatsSerializable | null;
40
+ triggerHandler?: TypeAheadHandler;
41
+ typeAheadHandlers: Array<TypeAheadHandler>;
42
42
  };
43
43
  export type OnInsertSelectedItemProps = {
44
- mode: SelectItemMode;
45
44
  index: number;
45
+ mode: SelectItemMode;
46
46
  query: string;
47
47
  };
48
48
  export type OnItemMatchProps = {
@@ -61,12 +61,12 @@ export type InsertionTransactionMeta = (editorState: EditorState) => Transaction
61
61
  type PopupMountPoints = Pick<UiComponentFactoryParams, 'popupsMountPoint' | 'popupsBoundariesElement' | 'popupsScrollableElement'>;
62
62
  export type PopupMountPointReference = Record<'current', PopupMountPoints | null>;
63
63
  export type CreateTypeAheadDecorations = (tr: ReadonlyTransaction, options: {
64
- triggerHandler: TypeAheadHandler;
65
64
  inputMethod: TypeAheadInputMethod;
66
65
  reopenQuery?: string;
66
+ triggerHandler: TypeAheadHandler;
67
67
  }) => {
68
- decorationSet: DecorationSet;
69
68
  decorationElement: HTMLElement | null;
69
+ decorationSet: DecorationSet;
70
70
  stats: TypeAheadStatsSerializable | null;
71
71
  };
72
72
  export type RemoveTypeAheadDecorations = (decorationSet?: DecorationSet) => boolean;
@@ -80,20 +80,20 @@ export type TypeAheadPluginOptions = {
80
80
  isMobile?: boolean;
81
81
  };
82
82
  export interface TypeAheadPluginSharedState {
83
- query: string;
84
- isOpen: boolean;
85
- isAllowed: boolean;
86
83
  currentHandler?: TypeAheadHandler;
87
- decorationSet: DecorationSet;
88
84
  decorationElement: HTMLElement | null;
89
- triggerHandler?: TypeAheadHandler;
90
- items: Array<TypeAheadItem>;
85
+ decorationSet: DecorationSet;
91
86
  errorInfo: TypeAheadErrorInfo;
87
+ isAllowed: boolean;
88
+ isOpen: boolean;
89
+ items: Array<TypeAheadItem>;
90
+ query: string;
92
91
  selectedIndex: number;
92
+ triggerHandler?: TypeAheadHandler;
93
93
  }
94
94
  export type OpenTypeAheadProps = {
95
- triggerHandler: TypeAheadHandler;
96
95
  inputMethod: TypeAheadInputMethod;
97
96
  query?: string;
98
97
  removePrefixTriggerOnCancel?: boolean;
98
+ triggerHandler: TypeAheadHandler;
99
99
  };
@@ -9,23 +9,23 @@ import type { TypeAheadItem } from '@atlaskit/editor-common/types';
9
9
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
10
10
  import { CloseSelectionOptions } from '../pm-plugins/constants';
11
11
  type InputQueryProps = {
12
- triggerQueryPrefix: string;
13
- onQueryChange: (query: string) => void;
14
- onItemSelect: (mode: SelectItemMode) => void;
15
- selectNextItem: () => void;
16
- selectPreviousItem: () => void;
17
12
  cancel: (props: {
13
+ addPrefixTrigger: boolean;
18
14
  forceFocusOnEditor: boolean;
19
15
  setSelectionAt: CloseSelectionOptions;
20
- addPrefixTrigger: boolean;
21
16
  text: string;
22
17
  }) => void;
23
- onQueryFocus: () => void;
18
+ editorView: EditorView;
24
19
  forceFocus: boolean;
20
+ items: TypeAheadItem[];
21
+ onItemSelect: (mode: SelectItemMode) => void;
22
+ onQueryChange: (query: string) => void;
23
+ onQueryFocus: () => void;
25
24
  onUndoRedo?: (inputType: 'historyUndo' | 'historyRedo') => boolean;
26
25
  reopenQuery?: string;
27
- editorView: EditorView;
28
- items: TypeAheadItem[];
26
+ selectNextItem: () => void;
27
+ selectPreviousItem: () => void;
28
+ triggerQueryPrefix: string;
29
29
  };
30
30
  export declare const InputQuery: React.MemoExoticComponent<({ triggerQueryPrefix, cancel, onQueryChange, onItemSelect, selectNextItem, selectPreviousItem, forceFocus, reopenQuery, onQueryFocus, onUndoRedo, editorView, items, }: InputQueryProps) => jsx.JSX.Element>;
31
31
  export {};
@@ -1,10 +1,10 @@
1
1
  import React, { type ReactNode, type MouseEventHandler } from 'react';
2
2
  import { type ListRowProps } from 'react-virtualized';
3
3
  type Props = {
4
+ children: ReactNode;
4
5
  measure: () => void;
5
- registerChild?: (element?: Element) => void;
6
6
  onMouseMove: MouseEventHandler<HTMLDivElement>;
7
- children: ReactNode;
7
+ registerChild?: (element?: Element) => void;
8
8
  } & Pick<ListRowProps, 'index' | 'style' | 'isScrolling' | 'isVisible'>;
9
9
  /**
10
10
  *
@@ -1,10 +1,10 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  type Props = {
3
- onClick: () => void;
4
- isFocused: boolean;
5
- title: string;
6
3
  ariaLabel?: string;
7
4
  iconBefore?: React.ReactNode;
5
+ isFocused: boolean;
6
+ onClick: () => void;
7
+ title: string;
8
8
  };
9
9
  export declare const MoreOptions: ({ onClick, isFocused, title, ariaLabel, iconBefore }: Props) => jsx.JSX.Element;
10
10
  export {};
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  type EmptyStateProps = {
3
- header: string;
4
- testId?: string;
5
3
  description?: React.ReactNode;
4
+ header: string;
6
5
  renderImage?: () => React.ReactNode;
6
+ testId?: string;
7
7
  };
8
8
  export declare const EmptyState: ({ testId, header, description, renderImage }: EmptyStateProps) => React.JSX.Element;
9
9
  export {};
@@ -11,29 +11,29 @@ import { type InputMethodType } from '../pm-plugins/analytics';
11
11
  import { type TypeAheadPlugin } from '../typeAheadPluginType';
12
12
  import type { TypeAheadHandler } from '../types';
13
13
  export declare const TypeAheadList: React.FC<import("react-intl-next").WithIntlProps<{
14
- items: Array<TypeAheadItem>;
15
- selectedIndex: number;
14
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
15
+ decorationElement: HTMLElement;
16
16
  editorView: EditorView;
17
- onItemClick: (mode: SelectItemMode, index: number, inputMethod?: InputMethodType) => void;
18
17
  fitHeight: number;
19
- decorationElement: HTMLElement;
20
- triggerHandler?: TypeAheadHandler;
18
+ items: Array<TypeAheadItem>;
21
19
  moreElementsInQuickInsertViewEnabled?: boolean;
22
- api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
23
- showMoreOptionsButton?: boolean;
20
+ onItemClick: (mode: SelectItemMode, index: number, inputMethod?: InputMethodType) => void;
24
21
  onMoreOptionsClicked?: () => void;
22
+ selectedIndex: number;
23
+ showMoreOptionsButton?: boolean;
24
+ triggerHandler?: TypeAheadHandler;
25
25
  } & WrappedComponentProps>> & {
26
26
  WrappedComponent: React.ComponentType<{
27
- items: Array<TypeAheadItem>;
28
- selectedIndex: number;
27
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
28
+ decorationElement: HTMLElement;
29
29
  editorView: EditorView;
30
- onItemClick: (mode: SelectItemMode, index: number, inputMethod?: InputMethodType) => void;
31
30
  fitHeight: number;
32
- decorationElement: HTMLElement;
33
- triggerHandler?: TypeAheadHandler;
31
+ items: Array<TypeAheadItem>;
34
32
  moreElementsInQuickInsertViewEnabled?: boolean;
35
- api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
36
- showMoreOptionsButton?: boolean;
33
+ onItemClick: (mode: SelectItemMode, index: number, inputMethod?: InputMethodType) => void;
37
34
  onMoreOptionsClicked?: () => void;
35
+ selectedIndex: number;
36
+ showMoreOptionsButton?: boolean;
37
+ triggerHandler?: TypeAheadHandler;
38
38
  } & WrappedComponentProps>;
39
39
  };
@@ -9,15 +9,15 @@ import { type ExtractInjectionAPI, type TypeAheadItem } from '@atlaskit/editor-c
9
9
  import { type TypeAheadPlugin } from '../typeAheadPluginType';
10
10
  export declare const itemIcon: import("@emotion/react").SerializedStyles;
11
11
  type TypeAheadListItemProps = {
12
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
13
+ ariaLabel?: string;
14
+ firstOnlineSupportedIndex: number;
12
15
  item: TypeAheadItem;
13
- itemsLength: number;
14
16
  itemIndex: number;
15
- selectedIndex: number;
16
- ariaLabel?: string;
17
- onItemClick: (mode: SelectItemMode, index: number) => void;
17
+ itemsLength: number;
18
18
  moreElementsInQuickInsertViewEnabled?: boolean;
19
- api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
20
- firstOnlineSupportedIndex: number;
19
+ onItemClick: (mode: SelectItemMode, index: number) => void;
20
+ selectedIndex: number;
21
21
  };
22
22
  export declare const TypeAheadListItem: React.MemoExoticComponent<({ item, itemsLength, selectedIndex, onItemClick, itemIndex, ariaLabel, moreElementsInQuickInsertViewEnabled, api, firstOnlineSupportedIndex, }: TypeAheadListItemProps) => jsx.JSX.Element>;
23
23
  export {};
@@ -4,11 +4,11 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { TypeAheadPlugin } from '../typeAheadPluginType';
5
5
  import type { PopupMountPointReference, TypeAheadPluginSharedState } from '../types';
6
6
  type TypeAheadMenuType = {
7
- typeAheadState: Omit<TypeAheadPluginSharedState, 'isOpen' | 'isAllowed' | 'selectedIndex'>;
7
+ api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
8
8
  editorView: EditorView;
9
9
  popupMountRef: PopupMountPointReference;
10
- api: ExtractInjectionAPI<TypeAheadPlugin> | undefined;
11
10
  selectedIndex: number;
11
+ typeAheadState: Omit<TypeAheadPluginSharedState, 'isOpen' | 'isAllowed' | 'selectedIndex'>;
12
12
  };
13
13
  export declare const TypeAheadMenu: React.MemoExoticComponent<({ editorView, popupMountRef, typeAheadState, selectedIndex, api }: TypeAheadMenuType) => React.JSX.Element | null>;
14
14
  export {};