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) 917 B
import Quill from "quill"; import { ON_WIKI_LINK_REMOVE } from "../constants.es.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(ON_WIKI_LINK_REMOVE, this.wikiData); return super.remove(); } } WikiLink.blotName = "wiki-link"; WikiLink.tagName = "A"; WikiLink.className = "ql-wiki-link"; export { WikiLink as default }; //# sourceMappingURL=wiki-link.es.js.map