UNPKG

@leoyin/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.

40 lines (39 loc) 1.51 kB
"use strict"; var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const Quill = require("quill"); const Parchment = Quill.import("parchment"); class MathliveBlot extends Parchment.EmbedBlot { constructor(scroll, domNode) { super(scroll, domNode); __publicField(this, "mode"); 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>`; } } __publicField(MathliveBlot, "blotName", "mathlive"); __publicField(MathliveBlot, "tagName", "math-field"); __publicField(MathliveBlot, "className", "ql-math-field"); exports.MathliveBlot = MathliveBlot; //# sourceMappingURL=formats.cjs.js.map