Plugins
OverviewHTML editors
CKEditor 5CKEditor 4 TinyMCE 6 and 7 TinyMCE 4 Froala Tiptap Angular
CMS and LMS
WordPress Moodle Canvas, Blackboard and LTI BloggerOther
Google Docs and Slides TiddlyWikiDevelopers
Writing your own
CKEditor 5
The fxEditor plugin for CKEditor 5 adds an fx button to the toolbar that opens the equation editor in a balloon, and inserts the result into your document. Try it:
Usage
- Click where the equation should go, then click fx on the toolbar.
- Build the equation in the maths view. The LaTeX toggle, bottom left, shows the LaTeX markup alongside it; the two stay in step as you edit either.
- Choose how it is inserted from the dropdown beside the toggles, then Insert.
- Double-click an existing equation to edit it again.
Installation
The plugin is published on npm as @codecogs/fxeditor-ckeditor5. It requires
CKEditor 5 v42 or later, the release that moved to the single
ckeditor5 package.
npm install ckeditor5 @codecogs/fxeditor-ckeditor5
Import it alongside your other CKEditor imports, add it to both plugins and
toolbar, and give it your licence key. The Image plugins are needed only
if equations may be inserted as images:
import { ClassicEditor, Essentials, Paragraph, Bold, Italic,
Image, ImageInline, ImageToolbar, ImageTextAlternative } from 'ckeditor5';
import { eqnEditor5 } from '@codecogs/fxeditor-ckeditor5';
import 'ckeditor5/ckeditor5.css';
ClassicEditor.create( document.querySelector( '#editor' ), {
licenseKey: 'GPL', // CKEditor's own licence
plugins: [ Essentials, Paragraph, Bold, Italic,
Image, ImageInline, ImageToolbar, ImageTextAlternative,
eqnEditor5 ],
toolbar: [ 'undo', 'redo', '|', 'bold', 'italic', '|', 'EqnEditor5' ],
eqnEditor: {
server: 'fxtex.codecogs.com',
licence: 'fx_pk_your-key-here', // fxEditor's licence, from the licence manager
design: { colour: '#0f7a4d' } // optional - see Customise and download below
}
} );
That is the whole integration. The equation editor itself is fetched from
fxtex.codecogs.com the first time it is needed, so there is nothing further to
bundle and you always get the current editor.
Two licence keys, two products. licenseKey is CKEditor's own;
eqnEditor.licence is ours, and activates the equation editor for your domain.
Without it, equations show the reason they cannot render in place of the maths. See
Activating with a licence key.
Customise and download
Make the equation editor your own: choose what it shows, drag panels from
More panels into up to three toolbar rows, and pick a colour and sizes. The preview is
the real CKEditor 5 page, rebuilt as you go. Then add your licence key and download it: an
example.html with a page of equations to edit, loading everything it needs from
fxplugins.codecogs.com.
Your toolbar
More panels 0
Your design
The option that gives CKEditor 5 this design — it is already in the download. Leave it out and the editor uses the standard design.
Your key is in the licence manager on fxEditor — or get one. Without a key, the download still works: equations show why they cannot render until you add one.
Complete example
The whole of the page running above: a simple, complete HTML page that loads CKEditor 5 and the
plugin. Every file comes from fxplugins.codecogs.com, so it works as it is —
put in your own licence key. (Keys are shortened here.)
What gets written into the page
The author chooses, from the dropdown in the equation balloon:
| Insert as | What lands in the document |
|---|---|
| MathML (default) |
The mathematics itself, with its spoken text attached for screen readers. Nothing to fetch when the page is viewed; it selects, scales and reflows with the surrounding text. |
| Image (SVG) | An <img> that fxTeX Server
renders, with the LaTeX as its alt text. Displays anywhere a picture can, but
every view of the page is a request to the rendering service. Needs CKEditor's
Image plugin. |
Both carry the LaTeX they were written from, so either can be reopened by double-clicking it. The plugin teaches CKEditor to keep MathML, so there is no schema for you to maintain.
MathML needs a stylesheet on the page that displays it. The plugin loads it into the editing view for you. On the page that finally shows your content, add:
<link rel="stylesheet" href="/api/browser/proxy?url=https%3A%2F%2Ffxtex.codecogs.com%2Ffxtex.css">
Configuration
Every option lives under the eqnEditor key.
| licence | Your fxEditor licence key. Required. | |
| design | The editor's look: dialog width, height and scale, toolbar panels and size, colour, equation and markup sizes, undo/redo, how the dialog opens. Build one in Customise and download; see A design. | |
| server | 'fxtex.codecogs.com' | Host the equation editor's own code is loaded from. A bare host means https; a full origin is used as it is. |
| renderUrl | 'https://fxtex.codecogs.com' | The rendering service for equations inserted as images. Point it at a self-hosted fxTeX Server to keep equations inside your network. |
| scriptUrl | from server | Full URL of the equation editor bundle, when the default path does not suit. |
| cssUrl | from server | Full URL of the equation editor stylesheet. |
| mathmlCssUrl | from server | The MathML stylesheet loaded into the editing view. |
Upgrading from earlier versions. insertAs, showLatex
and latexDisplay are no longer read: the author chooses MathML or an image in the
balloon itself, and shows or hides the LaTeX with its toggle. An option once documented as
Server, with a capital S, is still accepted, but server is the spelling
to use.
Change History
- v1.x - For CKEditor 4 (and, earlier, CKEditor 3).
- v2.0 - Rewritten as a single ES module against the
ckeditor5package, for CKEditor v42 and later. - v2.1 - Adds the WYSIWYG maths view, with the LaTeX markup alongside it. Equations carry their LaTeX as alt text. Fixes a crash when opening the equation editor while another balloon was showing, the dialog failing to close after Save, and two editors on one page interfering with each other.
- v2.2 - Inserts MathML by default, with SVG images as the alternative, chosen in the balloon. Activated with an fxEditor licence key.
- v2.3 - Published as
@codecogs/fxeditor-ckeditor5. Adds the design option.
CodeCogs®