@atlaskit/editor-plugin-quick-insert
Version:
Quick insert plugin for @atlaskit/editor-core
40 lines (39 loc) • 2.5 kB
TypeScript
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
import type { Command, QuickInsertPluginOptions as CommonQuickInsertPluginOptions, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, OptionalPlugin, QuickInsertHandler, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry/ui-control-registry-plugin-type';
export type QuickInsertSharedState = CommonQuickInsertSharedState & {
typeAheadHandler: TypeAheadHandler;
};
export type QuickInsertPluginOptions = CommonQuickInsertPluginOptions;
export type OpenElementBrowserOptions = {
category?: string;
};
export type QuickInsertPlugin = NextEditorPlugin<'quickInsert', {
actions: {
getSuggestions: (searchOptions: QuickInsertSearchOptions) => QuickInsertItem[];
insertItem: (item: QuickInsertItem, source?: INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR | INPUT_METHOD.ELEMENT_BROWSER) => Command;
openTypeAhead: (inputMethod: TypeAheadInputMethod, removePrefixTriggerOnCancel?: boolean) => boolean;
};
commands: {
addQuickInsertItem: (item: QuickInsertHandler) => EditorCommand;
openElementBrowser: (options?: OpenElementBrowserOptions) => EditorCommand;
/** @deprecated {@link https://hello.atlassian.net/browse/ENGHEALTH-62138 Internal documentation for deprecation (no external access)} Tracked by EDITOR-8422. Use `openElementBrowser` instead. */
openElementBrowserModal: EditorCommand;
removeQuickInsertItem: (key: string) => EditorCommand;
updateQuickInsertItem: (key: string, item: QuickInsertHandler) => EditorCommand;
};
dependencies: [
TypeAheadPlugin,
OptionalPlugin<ConnectivityPlugin>,
OptionalPlugin<MetricsPlugin>,
OptionalPlugin<AnalyticsPlugin>,
OptionalPlugin<UiControlRegistryPlugin>
];
pluginConfiguration: QuickInsertPluginOptions | undefined;
sharedState: QuickInsertSharedState | null;
}>;