Math and equations
Try built-in equation editing or connect your separately licensed WIRIS or MathType integration.
How it works
RichTextEditor does not bundle WIRIS or MathType.If you have licensed either, they connect through the same two calls any custom integration uses — the code is below. But you may not need them: the editor ships its own equation editor, and that is what the button here opens.
The built-in equation editor
A TeX input with a live preview, and edit-in-place when the caret is already inside an equation. No renderer is bundled: include KaTeX or MathJax on the page and equations render; leave them out and the TeX is stored intact either way.
// The built-in route — nothing to install.
editor.execCommand("insertmath"); // opens the equation dialog
// Equations are stored as .rte-math-inline markup carrying their TeX, so the
// saved HTML is portable and the caret can re-open an equation for editing.
// Rendering is the host page's job: include KaTeX or MathJax and the markup
// renders; omit it and the TeX is still there, intact.Saved HTML
Loading…
Bringing your own: WIRIS / MathType
Load the vendor’s script yourself, add a toolbar button, and put the result back with insertElement(). Nothing about the editor needs patching, and the same shape works for MathLive or any other editor that hands you markup.
// The third-party route. Load MathType/WIRIS yourself, then bridge it with
// two calls the editor already exposes.
var editor = new RichTextEditor("#div_editor1");
editor.createToolbarButton("mathtype", {
tooltip: "Insert equation",
onclick: function () {
// Hand off to the vendor's editor, then put its MathML back.
openWirisEditor(function (mathml) {
editor.insertElement(buildElementFrom(mathml));
});
}
});This page deliberately loads no third-party script. The product is kept free of external calls — customers run static scanners that flag them — so the integration is given as code to copy rather than as a live embed.