4
votes

I am using CK editor and implemented using jQuery. I have hidden the link option in ckeditor config.js such that i'll not have the link option in the toolbar. When i type a URL or link, on click event it loads the link(web page) into the my page/div. i have also restricted it by removing href. Now on URL double click it shows a link dialog with option like "Link type", "protocol", "URL" and ok cancel button. Now i want to restrict the dialog. ie: i don't want the dialog to pop up. Double click should work as it work in normal text. Can someone assist me on that. I have also tried "config.removeDialogTabs = 'image:advanced;link';" "config.removeDialogTabs = 'link:upload;image:Upload';"

CKEDITOR.on('dialogDefinition', function (ev) {

            var dialogName = ev.data.name;
            var dialogDefinition = ev.data.definition;

            switch (dialogName) {
                case 'image': //Image Properties dialog      
                    dialogDefinition.removeContents('advanced');
                    break;
                case 'link': //image Properties dialog          
                    dialogDefinition.removeContents('advanced');
                    break;
            }
        });

it doesn't work.

1

1 Answers

1
votes

The key is to write your own 'doubleclick' handler with a higher priority than the default one of the 'link' plugin and stop the event from propagating through.

    myEditor.on('doubleclick', function (evt) {
        var element = evt.data.element;

        if (element.is('a')){
            evt.stop(); // don't do the other listeners
            // optionally put your code 
        }

    }, null, null, 1); // 10 is default, so put something lower for higher priority