import { EventEmitter, type VFXItem } from '@galacean/effects'; import type { GizmoOwner } from '../gizmo-owner'; import type { TextEditActivation } from './types'; import type { TextResult } from '../gizmos/text-gizmo'; import { type ViewPoint } from './text-caret-mapper'; export type TextInteractionParam = { type: 'none' | 'edit'; textareaType?: TextEditActivation; }; export type TextInputPayload = { itemId: string; text: string; fontFamily: string; }; type TextEditSessionEvents = { textInput: [TextInputPayload]; }; /** TextEditMode 持有的持久文本会话;Gizmo rebuild 只挂接/脱离其画布投影。 */ export declare class TextEditSession extends EventEmitter { readonly textAreaElement: HTMLTextAreaElement; interactionParam: TextInteractionParam; private readonly _owner; private _editingItem; private readonly _attachedProjections; private _disposed; private _selectionStart; private _selectionEnd; private _pointerSelection; private readonly _caretMapper; private readonly _removeTextAreaStyle; constructor(owner: GizmoOwner); get editingItem(): VFXItem | undefined; get isEditing(): boolean; /** TextEditMode.onEnter 调用:此时对应 Gizmo 图已经安装。 */ beginFromCurrentSelection(textareaType: TextEditActivation): boolean; /** * Keep the current text-edit mode alive while moving the editing session to * another text item. The textarea is reopened on the next projection sync so * its value and layout come from the new target. */ retarget(item: VFXItem, textareaType?: TextEditActivation): boolean; beginPointerSelection(point: ViewPoint): void; updatePointerSelection(point: ViewPoint): void; finishPointerSelection(point: ViewPoint): void; cancelPointerSelection(): void; attachProjection(projection: object): void; detachProjection(projection: object): void; /** 只在 TextEditMode.onExit 中调用,完成最终文本清理。 */ dispose(): void; syncTextArea(result: TextResult, viewScale: number): void; private readonly _handleInput; private readonly _handleKeyDown; private readonly _handleMouseDown; private readonly _handleDragStart; private _saveSelectionRange; private _hideTextArea; private _syncPointerLayout; private _applyPointerSelection; private _getTextAlign; } export {};