Skip to content

Latest commit

 

History

History
53 lines (45 loc) · 2.2 KB

README.md

File metadata and controls

53 lines (45 loc) · 2.2 KB

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