Inserts the contents of a clip.
The clip to be pasted.
True if the insertion was possible.
Inserts a new chemical element by symbol. This is an alternative to inserting them by their full name as objects.
Example: Insert the symbol for gold.
let walker = new micd.Walker(editor);
walker.insert.element("Au");
The symbol of an element in ChemistryObject.
If true, the element is inserted as an isotope object instead of a simple element.
Inserts an identifier at the current position. Unlike a variable, an identifier can consist of multiple letters (like a variable name in a computer program). The result is an identifier parent node with a single field containing a character node for each letter in the name.
The identifier name.
The data type of the identifier (default is scalar).
True if the insertion was possible.
Inserts a number at the current position. As the editor does not represent numbers as a single object, this will result in the insertion of one or more digit nodes (a radix point is considered a type of digit).
This method will accept a string representation of a number, as well as JavaScript number or bigint values. To simplify working with external values, this method also handles some non-digit characters:
+
, -
, ±
, and ∓
characters will be inserted as operators;Infinity
will become an infinity symbol (∞);e
or E
) will become ×10 followed by
the relevant exponent;.
and ,
will be interpreted as radix points.Example: Insert a number using scientific notation
let walker = new micd.Walker(editor);
walker.insert.number("1.4e7");
The number to insert.
True if the insertion was possible. This will return false if passed NaN or an invalid number (such as one with multiple radix points).
Inserts an editor object by name. This is similar to apply, except that it rejects general editing commands.
The name of the command that inserts the object.
True if the insertion was possible.
Inserts an editor object by name. This is similar to apply, except that it rejects general editing commands.
The name of the command that inserts the object.
True if the insertion was possible.
Inserts a new operator. This can insert custom operators for which no command exists. If the operator has an existing command, it is recommended that it be inserted by command name as this ensures that the recommended Unicode character is used for its symbol.
Example: Insert an asterisk operator
let walker = new micd.Walker(editor);
walker.insert.operator("\u2217", micd.OperatorPlacement.infix);
Notes:
A string, 1 to 24 code points in length, to be used as the operator's symbol.
The operator's placement relative to its operand(s). If none is specified, a default is chosen based on the symbol.
True if the insertion was possible.
Inserts a style object whose children will be rendered with the specified style.
Example:
let walker = new micd.Walker(editor);
walker.insert.style(micd.Color.fromCss("powderblue"));
walker.insert.variable("Φ", "constant_scalar");
walker.insert.object(micd.EditorCommand.approximatelyEqualTo);
walker.insert.number(1.61803398874)
The color to apply to styled content.
True if the insertion was possible.
Inserts a text annotation at the current position. If the current position is inside of an existing text annotation, the text is inserted into the existing annotation.
The text content to insert.
True if the insertion was possible.
Inserts a variable at the current position. A variable name (symbol) must consist of exactly one Unicode code point. Only certain code points are allowed, typically letters. Using standard unaccented letters from the Latin or Greek alphabet is strongly recommended as other letters may not render correctly, especially when exported. Combinations not typically seen in mathematical writing, such as a constant set named with a lower case Latin letter, may not render as expected.
Unit names are composed of “variables” with the special data type "unit_name"
. If the current position is inside of a unit node, variables inserted with the default scalar variable data type will be silently converted to this type. Other data types will be rejected, returning false.
The variable name, which must be exactly one letter.
The data type of the variable (default is scalar).
The accent to place on the variable (default is none).
True if the insertion was possible.
This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.
Methods used to insert content into a document via a Walker. As with apply, the position of the walker will be updated to match the caret position after an insertion so that it is ready to insert more material.