Interface Field

A list of related child nodes. All nodes have zero or more fields: each field contains the content for a specific slot on the containing node; in editor views an empty field is shown as a rounded rectangular frame.

Most node types have a fixed number of fields; for example, a node representing a square root has exactly one field, while a node representing an nth root has exactly two fields (one for the content under the radical sign, and one for the root index). A few node types, such as matrices and the root node that contains the lines of the document, have variable numbers of fields.

Hierarchy

  • Field

Index

Properties

Methods

Properties

Optional Readonly cell

cell: [number, number]

If this field is part of a tabular node, returns the row and column of this cell in an array.

Readonly isOptional

isOptional: boolean

True if this field is optional; optional fields may be left empty by the user and the content will still make sense.

Readonly length

length: number

The number of child nodes present in the field.

Readonly number

number: number

The field number of this field in its node.

Methods

indexOf

  • indexOf(target: Node): number
  • Returns the index of the specified target node within the field, or -1 if the node does not occur in the field.

    Parameters

    • target: Node

      The node to find the index of.

    Returns number

    The index of the node, or -1.

nodeAt

  • nodeAt(index: number): Node
  • Returns the node at the specified list position. Returns null if the index is length; this represents the final caret position at the end of the field.

    Parameters

    • index: number

      The index of the node in the field, where the first node is at position 0.

    Returns Node

This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.