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.17 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const Quill = require("quill"); const formats = require("./formats.cjs.js"); const tooltip = require("./tooltip.cjs.js"); class MathliveModule { constructor(quill) { this.quill = quill; this.tooltip = new tooltip.default(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() === formats.default.tagName.toUpperCase() && node.classList.contains(formats.default.className)); const mathliveBlot = Quill.find(mathliveNode); if (mathliveBlot) { const { value, mode } = formats.default.value(mathliveBlot.domNode); if (mode === "dialog") { this.createDialog(value); } } }, true ); } createDialog(value) { this.tooltip.edit(value); } } exports.default = MathliveModule; //# sourceMappingURL=index.cjs.js.map