如何将ckeditor的a链接的target设置为_blank
super
2022-02-18 17:58
![views](/static/super/images/icon/evaluate-9a.png)
![](/uploads/article/20220218/dedfebe4d40ca8b971099bd8f5d93a1b.png)
在初始化参数时,加以下代码:
link: {
// https://ckeditor.com/docs/ckeditor5/latest/features/link.html
// addTargetToExternalLinks: true,
decorators: {
addTargetToExternalLinks: {
mode: 'automatic',
callback: url => /^(https?:)?\/\//.test( url ),
attributes: {
target: '_blank',
// rel: 'noopener noreferrer'
}
}
}
},
文档地址:https://ckeditor.com/docs/ckeditor5/latest/features/link.html
0 条讨论