只需单击一下,即可在CKEditor中打开链接

时间:2015-03-13 14:27:04

标签: ckeditor

我正在使用CKEditor,我已将链接放入文本中。当我们在CKEditor内的那个链接上点击(一次)时,是否可以直接转到链接?

2 个答案:

答案 0 :(得分:1)

你有没有试过这样的东西(需要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

修补程序

答案 1 :(得分:0)

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);
                }
            });
        });
相关问题