Open hwenjie opened 4 years ago
需要创建Link blot , 比如: // 自定义插入a链接 const Link = Quill.import('formats/link') class FileBlot extends Link { // 继承Link Blot static create(value) { let node if (value && !value.href) { // 适应原本的Link Blot node = super.create(value) } else { // 自定义Link Blot node = super.create(value.href) node.href = value.href // 不加会报错 node.download = value.innerText // 左键点击即下载 node.innerText = value.innerText } return node } } FileBlot.blotName = 'link' FileBlot.tagName = 'A' Quill.register(FileBlot)
然后再使用: this.quill.insertEmbed(self.cursorIndex, 'link', { href: self.fileURL, innerText: self.fileName })
BUG REPORT TEMPLATE