早睡早起,方能养生!
Sleep early rise early, way to keep healthy!

如何将ckeditor的a链接的target设置为_blank

super
2022-02-18 17:58
views 310

 

在初始化参数时,加以下代码:

 

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 条讨论
top