UNPKG

@atlaskit/editor-plugin-type-ahead

Version:

Type-ahead plugin for @atlaskit/editor-core

43 lines (42 loc) 2.22 kB
import type { IntlShape } from 'react-intl'; import type { ExtractInjectionAPI, TypeAheadItem } from '@atlaskit/editor-common/types'; import type { EditorState } from '@atlaskit/editor-prosemirror/state'; import type { EditorView } from '@atlaskit/editor-prosemirror/view'; import type { TypeAheadPlugin } from '../typeAheadPluginType'; import type { TypeAheadHandler, TypeAheadPluginState } from '../types'; export declare const isTypeAheadHandler: (handler: any) => handler is TypeAheadHandler; /** Is a typeahead plugin open? */ export declare const isTypeAheadOpen: (editorState: EditorState) => boolean; export declare const getPluginState: (editorState: EditorState) => TypeAheadPluginState | undefined; export declare const getTypeAheadHandler: (editorState: EditorState) => TypeAheadHandler | undefined; export declare const getTypeAheadQuery: (editorState: EditorState) => string | undefined; export declare const isTypeAheadAllowed: (state: EditorState) => boolean; export declare const findHandler: (id: string, state: EditorState) => TypeAheadHandler | null; export declare const skipForwardToSafeItem: ({ currentIndex, nextIndex, listSize, itemIsDisabled, }: { currentIndex: number; itemIsDisabled: (idx: number) => boolean; listSize: number; nextIndex: number; }) => number; export declare const skipBackwardToSafeItem: ({ currentIndex, nextIndex, listSize, itemIsDisabled, }: { currentIndex: number; itemIsDisabled: (idx: number) => boolean; listSize: number; nextIndex: number; }) => number; export declare const findHandlerByTrigger: ({ trigger, editorState, }: { editorState: EditorState; trigger: string; }) => TypeAheadHandler | null; type MoveSelectedIndexProps = { api: ExtractInjectionAPI<TypeAheadPlugin> | undefined; direction: 'next' | 'previous'; editorView: EditorView; }; export declare const moveSelectedIndex: ({ editorView, direction, api }: MoveSelectedIndexProps) => () => void; type TypeAheadAssistiveLabels = { listItemAriaLabel?: string; popupAriaLabel: string; }; export declare const getTypeAheadListAriaLabels: (trigger: string | undefined, intl: IntlShape, item?: TypeAheadItem) => TypeAheadAssistiveLabels; export {};