import type { EditorPlugin, IEditor, PickerDataProvider, PickerPluginOptions, PluginEvent } from 'roosterjs-editor-types'; /** * PickerPlugin represents a plugin of editor which can handle picker related behaviors, including * - Show picker when special trigger key is pressed * - Hide picker * - Change selection in picker by Up/Down/Left/Right * - Apply selected item in picker * * PickerPlugin doesn't provide any UI, it just wraps related DOM events and invoke callback functions. */ export default class PickerPlugin implements EditorPlugin { readonly dataProvider: T; private pickerOptions; private editor; private eventHandledOnKeyDown; private blockSuggestions; private isSuggesting; private lastKnownRange; private isPendingInputEventHandling; private currentInputLength; private newInputLength; constructor(dataProvider: T, pickerOptions: PickerPluginOptions); /** * Get a friendly name */ getName(): string; /** * Initialize this plugin. This should only be called from Editor * @param editor Editor instance */ initialize(editor: IEditor): void; /** * Dispose this plugin */ dispose(): void; /** * Check if the plugin should handle the given event exclusively. * Handle an event exclusively means other plugin will not receive this event in * onPluginEvent method. * If two plugins will return true in willHandleEventExclusively() for the same event, * the final result depends on the order of the plugins are added into editor * @param event The event to check */ willHandleEventExclusively(event: PluginEvent): boolean; /** * Handle events triggered from editor * @param event PluginEvent object */ onPluginEvent(event: PluginEvent): void; private setLastKnownRange; private setIsSuggesting; private cancelDefaultKeyDownEvent; private getIdValue; private getWordBeforeCursor; private replaceNode; private getRangeUntilAt; private shouldHandleKeyUpEvent; private onKeyUpDomEvent; private onKeyDownEvent; private getParentNodeIfTextNode; private onAndroidInputEvent; private calcInputLength; private tryRemoveNode; private getWord; private setRangeStart; private setAriaOwns; private setAriaActiveDescendant; private getInlineElementBeforeCursor; private isAndroidKeyboardEvent; }