如何将ckeditor的a链接的target设置为_blank
super
2022-02-18 17:58


在初始化参数时,加以下代码:
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 条讨论