Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Editor<TState, TEvent>

An editor for blocks of a specific language. Editors follow the Elm architecture - it defines a state together with events that can be triggered by actions in the user interface. The render function renders the current state as a Virtual DOM node and the update function calculates a new state when given an old state and an event.

Type parameters

Hierarchy

  • Editor

Index

Methods

initialize

  • initialize(id: number, block: Block): TState
  • Initialize the editor state for a given block with a given (unique) block ID

    Parameters

    • id: number
    • block: Block

    Returns TState

render

  • Render the block using the current editor state. The editor context that is also passed to the render function can be used to trigger events when the user performs some action (this triggers re-render of the page)

    Parameters

    Returns VNode

update

  • update(state: TState, event: TEvent): TState
  • The update function takes an event (trggered by the event handlers returned in the rendered Virutal DOM nodes) together with the current state of the editor and produces a new state.

    Parameters

    • state: TState
    • event: TEvent

    Returns TState

Generated using TypeDoc