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.

35 lines (34 loc) 1.04 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const Quill = require("quill"); const constants = require("../constants.cjs.js"); const Embed = Quill.imports["blots/embed"]; class WikiLink extends Embed { static create(value) { const node = super.create(value); node.setAttribute("href", value.link); node.setAttribute("target", "_blank"); node.setAttribute("title", value.text); node.textContent = value.text; return node; } static value(domNode) { return { link: domNode.getAttribute("href"), text: domNode.textContent }; } constructor(scroll, domNode, data) { super(scroll, domNode, data); this.wikiData = data; } remove() { this.scroll.emitter.emit(constants.ON_WIKI_LINK_REMOVE, this.wikiData); return super.remove(); } } WikiLink.blotName = "wiki-link"; WikiLink.tagName = "A"; WikiLink.className = "ql-wiki-link"; exports.default = WikiLink; //# sourceMappingURL=wiki-link.cjs.js.map