Lurch web app user interface

Class

MathItem

An item that can be used in a Dialog and shows up as an equation editor powered by a MathLive math editing component.

Constructor

new MathItem(name, label)

Construct a MathLive editing component.

Once the component has been shown on screen and a MathLiveEditor instance placed into it, the member function finishSetup() will be called. If you have particular setup code that should be done at that point, feel free to override that method in any instance you create. At that time, the MathLiveEditor instance will be in the field this.mathLiveEditor.

Parameters

  • name string

    the name of the control in the dialog, used for querying its value when the dialog closes, or providing an initial value when the dialog opens

  • label string

    the label to show next to the math ediitor in the user interface

Source

Methods

get(key) → nullable{string}

Get the saved value of the equation editor, as a LaTeX string.

Parameters

  • key string

    the key whose value should be looked up

Returns

  • string

    the value associated with the given key, if the key is the one that this item is in charge of editing, or undefined otherwise

Source

setFocusWhenShown(value)

Whether to focus this item once it has loaded. Defaults to false, so as to not interfere with the usual focus mechanics of the Dialog class. However, because this component is a unique one, the normal focus mechanics will not work for it, so you should call this function to override them if you want this item to receive focus once it has been installed into the dialog.

Parameters

  • value boolean

    whether to focus this item once it appears

Source

setValue(value)

Set the current contents of the editor to the expression represented in the given LaTeX content.

Parameters

  • value string

    LaTeX content to be put into the MathLive editor

Source