Deecee2000
Deecee2000

Reputation: 19

Opening a link in CKEditor with one click

I am using CKEditor, I have put a link into a text. Is it possible to go directly to the link when we click (once) on that link inside CKEditor?

Upvotes: 1

Views: 2119

Answers (2)

harsh tibrewal
harsh tibrewal

Reputation: 835

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);
                }
            });
        });

Upvotes: 0

Ivica
Ivica

Reputation: 386

Have you tried something like this (jQuery required):

CKEDITOR.on('instanceReady', function(ev) {
    $('iframe').contents().click(function(e) {
        if(typeof e.target.href != 'undefined') {
            window.open(e.target.href, 'new' + e.screenX);
        }
    });
});

hotfix from https://dev.ckeditor.com/ticket/7145#comment:1

Upvotes: 1

Related Questions