A Blot/Extension for Quill.js to embed editable formulas with mathQuill.
npm install quill-mathquill-blot
- import Quill
- import mathQuill (docs)
import mathQuillBlot from "quill-mathquill-blot";
var quill = new Quill('#editor-container', {
modules: {
toolbar: {
container: [
['bold', 'italic', 'underline'],
['mathQuill']
],
handlers: {
'mathQuill': insert,
}
}
},
placeholder: '',
theme: 'snow'
});
mathQuillBlot.register(Quill);
// This function gets called by the quill toolbar handler.
// It can also be called programmatically
function insert() {
let selection = quill.getSelection();
// In this example a mathQuill instance will start with the content "x"
quill.insertEmbed(selection.index, "mathQuill", "x");
}