import type { InlineEditor } from '../inline-editor.js'; import type { InlineRange } from '../types.js'; import type { BaseTextAttributes } from '../utils/base-attributes.js'; export interface BeforeinputHookCtx { inlineEditor: InlineEditor; raw: InputEvent; inlineRange: InlineRange; data: string | null; attributes: TextAttributes; } export interface CompositionEndHookCtx< TextAttributes extends BaseTextAttributes, > { inlineEditor: InlineEditor; raw: CompositionEvent; inlineRange: InlineRange; data: string | null; attributes: TextAttributes; } export type HookContext = | BeforeinputHookCtx | CompositionEndHookCtx; export class InlineHookService { constructor( readonly editor: InlineEditor, readonly hooks: { beforeinput?: (props: BeforeinputHookCtx) => void; compositionEnd?: (props: CompositionEndHookCtx) => void; } = {} ) {} }