0
rel
とtarget
を手動で設定する必要があるカスタムブロットを作成しました。しかし、これらの属性を持つコンテンツを読み込むときには、それらを取り除きます。なぜ私は分からない。カスタムブロットを使用すると、カスタム属性が削除されます
問題を説明するためにcodepenを作成しました。
これは私のカスタムブロットである:
const Inline = Quill.import('blots/inline')
class CustomLink extends Inline {
static create(options) {
const node = super.create()
node.setAttribute('href', options.url)
if (options.target) { node.setAttribute('target', '_blank') }
if (options.follow === 'nofollow') { node.setAttribute('rel', 'nofollow') }
return node
}
static formats(node) {
return node.getAttribute('href')
}
}
CustomLink.blotName = 'custom_link'
CustomLink.tagName = 'A'
Quill.register({'formats/custom_link': CustomLink})
は、私は特定のatttributesを許可するようにクイルを伝える必要がありますか?