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.

33 lines (32 loc) 1.08 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const Quill = require("quill"); const file = require("./formats/file.cjs.js"); const fileBar = require("./modules/file-bar.cjs.js"); const Module = Quill.imports["core/module"]; class FileModule extends Module { static register() { Quill.register("formats/file", file.default, true); } constructor(quill, options) { super(quill, options); this.quill = quill; quill.root.addEventListener("click", (event) => this.clickEvent(event), false); } clickEvent(event) { event.preventDefault(); const target = event.target; const fileDom = target.closest("a.ql-file-item"); if (fileDom) { if (this.fileBar) { this.fileBar.destroy(); } this.fileBar = new fileBar.default(this.quill, fileDom); } else if (this.fileBar && !target.closest(".ql-file-bar")) { this.fileBar.destroy(); this.fileBar = null; } } } exports.default = FileModule; //# sourceMappingURL=index.cjs.js.map