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.

37 lines (36 loc) 1.2 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const Quill = require("quill"); const Parchment = Quill.import("parchment"); const _MathliveBlot = class _MathliveBlot extends Parchment.EmbedBlot { constructor(scroll, domNode) { super(scroll, domNode); this.domNode = domNode; domNode.setAttribute("contenteditable", "false"); this.mode = domNode.getAttribute("mode") || "only-read"; } static create(obj) { const el = super.create(); el.setAttribute("mode", obj.mode); el.classList.add("view"); el.innerHTML = obj.value; el.setValue(obj.value); return el; } static value(domNode) { return { value: domNode.value, mode: domNode.getAttribute("mode") }; } html() { const formula = this.domNode.value; return `<math-field class="ql-math-field view" contenteditable="false" mode="${this.mode}">${formula}</math-field>`; } }; _MathliveBlot.blotName = "mathlive"; _MathliveBlot.tagName = "math-field"; _MathliveBlot.className = "ql-math-field"; let MathliveBlot = _MathliveBlot; exports.default = MathliveBlot; //# sourceMappingURL=formats.cjs.js.map