@atlaskit/editor-plugin-type-ahead
Version:
Type-ahead plugin for @atlaskit/editor-core
61 lines (60 loc) • 2.48 kB
TypeScript
import type { TypeAheadItem } from '@atlaskit/editor-common/provider-factory';
import { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
import type { Command } from '@atlaskit/editor-common/types';
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
import type { TypeAheadHandler, TypeAheadInputMethod } from '../types';
type CloseOptions = {
attachCommand?: Command;
insertCurrentQueryAsRawText: boolean;
};
type InsertItemProps = {
contentItem: TypeAheadItem;
query: string;
sourceListItem: TypeAheadItem[];
};
/**
* Please do not use it. Ping #help-editor and talk to the Lego team before use it.
*
* @private
* @deprecated
*
*/
export declare const createTypeAheadTools: (editorView: EditorView) => {
close: (options?: CloseOptions) => boolean;
currentQuery: () => string | undefined;
insertItemEmoji: ({ contentItem, query, sourceListItem }: InsertItemProps) => boolean;
insertItemMention: ({ contentItem, query, sourceListItem }: InsertItemProps) => boolean;
insertItemQuickInsert: ({ contentItem, query, sourceListItem }: InsertItemProps) => boolean;
isOpen: () => TypeAheadHandler | false;
openEmoji: (inputMethod: TypeAheadInputMethod) => boolean;
openMention: (inputMethod: TypeAheadInputMethod) => boolean;
openQuickInsert: (inputMethod: TypeAheadInputMethod) => boolean;
searchEmoji: (query?: string) => {
close: (options?: CloseOptions) => boolean;
insert: ({ index, mode }: {
index: number;
mode?: SelectItemMode;
}) => Promise<void>;
result: () => Promise<TypeAheadItem[] | undefined>;
type: (appendValue: string) => Promise<TypeAheadItem[]> | undefined;
};
searchMention: (query?: string) => {
close: (options?: CloseOptions) => boolean;
insert: ({ index, mode }: {
index: number;
mode?: SelectItemMode;
}) => Promise<void>;
result: () => Promise<TypeAheadItem[] | undefined>;
type: (appendValue: string) => Promise<TypeAheadItem[]> | undefined;
};
searchQuickInsert: (query?: string) => {
close: (options?: CloseOptions) => boolean;
insert: ({ index, mode }: {
index: number;
mode?: SelectItemMode;
}) => Promise<void>;
result: () => Promise<TypeAheadItem[] | undefined>;
type: (appendValue: string) => Promise<TypeAheadItem[]> | undefined;
};
};
export {};