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.29 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const Quill = require("quill"); const constants = require("../constants.cjs.js"); const createTable = require("../utils/createTable.cjs.js"); const BlockEmbed = Quill.imports["blots/block/embed"]; class WorkItemLink extends BlockEmbed { static create(value) { const node = super.create(value); node.setAttribute("contenteditable", "false"); node.setAttribute("href", value.link); node.setAttribute("__work_item_data__", JSON.stringify(value.data)); const table = createTable.createTable(value.data); node.appendChild(table); return node; } static value(domNode) { return { link: domNode.getAttribute("href"), data: JSON.parse(domNode.getAttribute("__work_item_data__")) }; } constructor(scroll, domNode, data) { super(scroll, domNode, data); this.workItemData = data; } remove() { this.scroll.emitter.emit(constants.ON_WORK_ITEM_LINK_REMOVE, this.workItemData); return super.remove(); } } WorkItemLink.blotName = "work-item-link"; WorkItemLink.tagName = "div"; WorkItemLink.className = "ql-work-item-link"; exports.default = WorkItemLink; //# sourceMappingURL=work-item-link.cjs.js.map