@atlaskit/editor-plugin-type-ahead
Version:
Type-ahead plugin for @atlaskit/editor-core
132 lines (108 loc) • 3.72 kB
Markdown
<!-- API Report Version: 2.3 -->
## API Report File for "@atlaskit/editor-plugin-type-ahead"
> Do not edit this file. This report is auto-generated using
> [API Extractor](https://api-extractor.com/).
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
### Table of contents
- [Main Entry Types](#main-entry-types)
- [Peer Dependencies](#peer-dependencies)
### Main Entry Types
<!--SECTION START: Main Entry Types-->
```ts
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
import type { Command } from '@atlaskit/editor-common/types';
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
import type { TypeAheadItem } from '@atlaskit/editor-common/types';
import type { TypeAheadStats } from '@atlaskit/editor-common/types';
// @public (undocumented)
type CloseTypeAheadProps = {
insertCurrentQueryAsRawText: boolean;
attachCommand?: Command;
};
// @public (undocumented)
type InsertTypeAheadItemProps = {
triggerHandler: TypeAheadHandler;
contentItem: TypeAheadItem;
query: string;
sourceListItem: TypeAheadItem[];
mode?: SelectItemMode;
};
// @public (undocumented)
type OpenTypeAheadProps = {
triggerHandler: TypeAheadHandler;
inputMethod: TypeAheadInputMethod;
query?: string;
};
export { TypeAheadHandler };
// @public (undocumented)
export type TypeAheadInputMethod =
| INPUT_METHOD.INSERT_MENU
| INPUT_METHOD.KEYBOARD
| INPUT_METHOD.QUICK_INSERT
| INPUT_METHOD.TOOLBAR;
// @public
export type TypeAheadPlugin = NextEditorPlugin<
'typeAhead',
{
pluginConfiguration: TypeAheadPluginOptions | undefined;
dependencies: [OptionalPlugin<AnalyticsPlugin>];
sharedState: {
query: string;
isOpen: boolean;
isAllowed: boolean;
currentHandler?: TypeAheadHandler;
};
actions: {
isOpen: (editorState: EditorState) => boolean;
isAllowed: (editorState: EditorState) => boolean;
insert: (props: InsertTypeAheadItemProps) => boolean;
findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
open: (props: OpenTypeAheadProps) => boolean;
close: (props: CloseTypeAheadProps) => boolean;
openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
};
}
>;
// @public
export const typeAheadPlugin: TypeAheadPlugin;
// @public (undocumented)
export type TypeAheadPluginOptions = {
isMobile?: boolean;
};
// @public (undocumented)
export type TypeAheadPluginState = {
decorationSet: DecorationSet;
decorationElement: HTMLElement | null;
typeAheadHandlers: Array<TypeAheadHandler>;
query: string;
items: Array<TypeAheadItem>;
triggerHandler?: TypeAheadHandler;
selectedIndex: number;
stats: TypeAheadStatsSerializable | null;
inputMethod: TypeAheadInputMethod | null;
};
// @public (undocumented)
interface TypeAheadStatsSerializable extends TypeAheadStats {
// (undocumented)
serialize: () => TypeAheadStats;
}
// (No @packageDocumentation comment for this package)
```
<!--SECTION END: Main Entry Types-->
### Peer Dependencies
<!--SECTION START: Peer Dependencies-->
```json
{
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-intl": "npm:react-intl@^5.18.1"
}
```
<!--SECTION END: Peer Dependencies-->