An entry describing one button in a row of palette buttons. This can be a single string to assign a primary action, or an array of two strings to assign both primary and secondary actions (activated with Shift). Each string can be a single character to assign an action that inserts that character as a variable or digit, or it can be the name of a command. Not all commands can be used, but all math object commands can. If the entry is a CustomPaletteButtonTemplate object, a custom button will be created that performs its own handling when clicked. Finally, if the entry is null
, it will produce a spacer that consumes the same space as a button but does nothing if clicked.
Describes a single row in a PaletteTemplate. This can be any of: null
to insert a separator row; a single string to insert a row of one button; or an array of 1–6 PaletteButtonTemplates. Rows with either 2 or 4 buttons generally create the best layouts. When enabled, palettes will split each row in two at narrow window widths. In rows with an odd number of buttons, the final entry will be on a line of its own.
When the API is loaded in "editor"
mode, this will be set to the shared global shell. (If the shared shell is disposed of, this becomes null
.) Otherwise it is undefined
.
Returns a Promise that resolves to a new Shell. The shell will be created asynchronously and appended to the specified element as a new child element.
The element to append the shell's root DOM node to; defaults to document.body
.
Options that affect the shell's features.
A Promise that resolves to the new shell.
Returns a new array that describes the default panel configuration used by a shell. The array contains two elements, one for each side panel. Each element is an array of strings, where each string is the name of a built-in palette.
Returns a new array of all of the shells that are currently on the page.
A (possibly empty) array in which each element is a shell that has been added to the DOM.
Given the name of a built-in palette, returns a human-friendly label that describes the palette contents.
Returns a new array in which each element describes one of the available built-in palettes, and for each palette type, which variants are supported.
Returns the shell that contains the specified element, or null if the element is not part of a shell.
The element (or DOM node) that may be a descendent of a shell.
The shell that the element is a descendent of, or null.
This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.
This namespace contains the API related to Shells, an optional API component that provides a richer editing experience than a simple View. New shells are created by calling the create function, which returns a Promise that resolves to the new shell (after loading the shell API if necessary).
Example: Append a new Shell to the page