UNPKG

@opentiny/fluent-editor

Version:

A rich text editor based on Quill 2.0, which extends rich modules and formats on the basis of Quill. It's powerful and out-of-the-box.

34 lines (33 loc) 1.04 kB
import Quill from "quill"; import MathliveBlot from "./formats.es.js"; import MathliveTooltip from "./tooltip.es.js"; class MathliveModule { constructor(quill) { this.quill = quill; this.tooltip = new MathliveTooltip(quill); this.quill.root.addEventListener( "click", (e) => { if (!this.quill.isEnabled()) return; const path = e.composedPath(); if (!path || path.length <= 0) return; const mathliveNode = path.find((node) => node.tagName && node.tagName.toUpperCase() === MathliveBlot.tagName.toUpperCase() && node.classList.contains(MathliveBlot.className)); const mathliveBlot = Quill.find(mathliveNode); if (mathliveBlot) { const { value, mode } = MathliveBlot.value(mathliveBlot.domNode); if (mode === "dialog") { this.createDialog(value); } } }, true ); } createDialog(value) { this.tooltip.edit(value); } } export { MathliveModule as default }; //# sourceMappingURL=index.es.js.map