Textarea (from Input)

A box which allows multiline text input.

Options

  • Inherits all from Input.
  • keys - Use pre-defined keys (i or enter for insert, e for editor, C-e for editor while inserting).
  • mouse - Use pre-defined mouse events (right-click for editor).
  • inputOnFocus - Call readInput() when the element is focused. Automatically unfocus.

Properties

  • Inherits all from Input.
  • value - The input text. read-only.

Events

  • Inherits all from Input.
  • submit - Value is submitted (enter).
  • cancel - Value is discared (escape).
  • action - Either submit or cancel.

Methods

  • Inherits all from Input.
  • submit - Submit the textarea (emits submit).
  • cancel - Cancel the textarea (emits cancel).
  • readInput(callback) - Grab key events and start reading text from the keyboard. Takes a callback which receives the final value.
  • readEditor(callback) - Open text editor in $EDITOR, read the output from the resulting file. Takes a callback which receives the final value.
  • getValue() - The same as this.value, for now.
  • clearValue() - Clear input.
  • setValue(text) - Set value.

Last update: February 22, 2020