diff --git a/packages/tui/src/components/editor.ts b/packages/tui/src/components/editor.ts index cda6387da..5fa01fd7b 100644 --- a/packages/tui/src/components/editor.ts +++ b/packages/tui/src/components/editor.ts @@ -1594,6 +1594,10 @@ export class Editor implements Component, Focusable { this.#resetKillSequence(); this.#setTextInternal(text); } + submit(): void { + if (this.disableSubmit) return; + this.#submitValue(); + } #exitHistoryForEditing(): void { if (this.#historyIndex === -1) return; diff --git a/packages/tui/src/editor-component.ts b/packages/tui/src/editor-component.ts index 2ea958898..247768432 100644 --- a/packages/tui/src/editor-component.ts +++ b/packages/tui/src/editor-component.ts @@ -29,6 +29,9 @@ export interface EditorComponent extends Component { /** Called when user submits (e.g., Enter key) */ onSubmit?: (text: string) => void; + /** Programmatically trigger submission (optional, e.g. for voice submit). */ + submit?(): void; + /** Called when text changes */ onChange?: (text: string) => void;