import { EditorState } from '../constants/EditorState'; import { EditorStatePropertyType } from '../constants/EditorStatePropertyType'; import { AIPopoverOptions, EmojiPopoverOptions } from '../constants/Popover'; import { ImmutableCssNode, ImmutableHtmlNode } from '../modifications/ImmutableNode'; import { CustomFontFamily } from '../ui-elements/CustomFontFamily'; export interface BaseApi { /** * Gets the root immutable HTML node of the document template. * @returns The root ImmutableHtmlNode. */ getDocumentRootHtmlNode(): ImmutableHtmlNode; /** * Gets the root immutable CSS node of the document's stylesheet. * @returns The root ImmutableCssNode. */ getDocumentRootCssNode(): ImmutableCssNode; /** * Retrieves the current configuration settings of the editor instance. * @returns A record object containing editor configuration key-value pairs. */ getEditorConfig(): Record; /** * Translates a given key into the currently configured language, optionally interpolating parameters. * @param key - The localization key to translate. * @param params - Optional parameters for interpolation into the translated string. * @returns The translated string. */ translate(key: string, params?: Record): string; /** * @description Adds new font to editor config. */ addCustomFont(font: CustomFontFamily): void; /** * @description Sets editor click outside behavior. * Allows extension user to interact with additional extension UI without triggering block deselect. * @param ignore - disables/enables block deselect on click outside. */ ignoreClickOutside(ignore: boolean): void; /** * @description return information about active state of the editor */ getEditorState(): EditorState; /** * @description allows to subscribe to property of editor's active state */ onEditorStatePropUpdated(prop: EditorStatePropertyType, callback: (newValue: unknown, oldValue: unknown) => void): void; /** * Opens an AI popover anchored to a target element. * @param {AIPopoverOptions} options Options including target element, preferred sides, type, and initial value. * @see {AIPopoverOptions} */ openAIPopover(options: AIPopoverOptions): void; /** * Opens emoji picker popover anchored to a target element. * @param {EmojiPopoverOptions} options Options including target element, preferred sides, and onResult callback. * @see {EmojiPopoverOptions} */ openEmojiPopover(options: EmojiPopoverOptions): void; /** * @description Sends an event with the specified type and additional params. * The `type` represents the event identifier, while `params` contains * arbitrary contextual data related to the event. * This method performs a fire-and-forget operation and does not return a value. */ sendEvent(type: string, params: Record): void; }