只需单击一下,即可在CKEditor中打开链接
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了只需单击一下,即可在CKEditor中打开链接相关的知识,希望对你有一定的参考价值。
我正在使用CKEditor,我已经在文本中添加了一个链接。当我们点击(一次)CKEditor内的链接时,是否可以直接转到链接?
答案
你尝试过类似的东西(需要jQuery):
CKEDITOR.on('instanceReady', function(ev) {
$('iframe').contents().click(function(e) {
if(typeof e.target.href != 'undefined') {
window.open(e.target.href, 'new' + e.screenX);
}
});
});
来自https://dev.ckeditor.com/ticket/7145#comment:1的修补程序
另一答案
CKEDITOR.on('instanceReady', function (ev) {
$('iframe').contents().click(function (e) {
if (typeof e.target.href !== 'undefined') {
window.open(e.target.href, 'new' + e.screenX);
} else if (typeof e.currentTarget.activeElement.href !== 'undefined') {
window.open(e.currentTarget.activeElement.href, 'new' + e.screenX);
}
});
});
以上是关于只需单击一下,即可在CKEditor中打开链接的主要内容,如果未能解决你的问题,请参考以下文章