import { Plugin, PluginKey } from 'prosemirror-state'; import { type EditorView } from 'prosemirror-view'; import type { MentionAttrs } from './mention'; /** The active trigger and the query the user is typing after it. */ export interface SuggestionState { trigger: string; /** Text between the trigger and the caret. May contain spaces. */ query: string; /** Document position of the trigger character. */ from: number; /** Document position of the caret — the end of the query. */ to: number; } interface SuggestionPluginState { active: SuggestionState | null; /** * A range the user dismissed with Escape or the space-cancel rule. Blocks * re-detection until the query changes, so the menu does not spring back. */ dismissed: { from: number; query: string; } | null; } export interface SuggestionPluginOptions { /** Trigger characters that are currently registered. */ getTriggers: () => string[]; /** Notified whenever the active query changes. */ onStateChange: (state: SuggestionState | null) => void; /** * Called for every keydown while a query is active. Return true to consume * the key — the handler owns `preventDefault` and `stopPropagation`. */ onKeyDown: (event: KeyboardEvent, state: SuggestionState) => boolean; } export declare const suggestionPluginKey: PluginKey; export declare function suggestionPlugin(options: SuggestionPluginOptions): Plugin; /** Closes the menu and leaves the typed text literal. */ export declare function dismissSuggestion(view: EditorView): void; /** * Replaces `range` with a chip followed by a single space, caret after it. * With no range the chip lands at the caret. */ export declare function insertMention(view: EditorView, attrs: MentionAttrs, range?: { from: number; to: number; }): void; export {}; //# sourceMappingURL=suggestion-plugin.d.ts.map