Skip to content

JonathanTreffler/Quill-mathQuill-blot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm npm bundle size npm GitHub Lint Workflow Status GitHub CodeQL Workflow Status GitHub Demo Deploy Workflow Status GitHub GitHub last commit Maintenance

Quill mathQuill Blot

A Blot/Extension for Quill.js to embed editable formulas with mathQuill.

Installation:

npm install quill-mathquill-blot

Usage:

  • 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");
}