1

I want to know the coordinates of the mouse pointer when I r-click on CKEditor

I added a few items to the context menu of CKEditor. i want when I select a certain item, the other a notice appeared also in place i r_click

 $(document).ready(function () {
    var ck = CKEDITOR.replace('txtNoidungBR', 'vi');
    var $DK = $('#divAddDK');
    /*Thêm điều kiện*/
    ck.on('instanceReady', function (e) {

        ck.addCommand("addDK", {
            exec: function (ck) {
            /*I want to set coordinates to $DK = coordinates of context menu when i r-click*/
                $DK.css({ 'left': 600, 'top': 400 }).toggle(300);

            }
        });

        ck.addMenuGroup('BRDT');

        var addDK = {
            label: 'Thêm điều kiện',
            command: 'addDK',
            group: 'BRDT'
        };

        ck.contextMenu.addListener(function (element, selection) {
            return {
                addDK: CKEDITOR.TRISTATE_OFF
            };
        });

        ck.addMenuItems({
            addDK: {
                label: 'Thêm điều kiện',
                command: 'addDK',
                group: 'BRDT',
                order: 1
            }
        });
    });
});

help me. thaks

Netloh
  • 4,338
  • 4
  • 25
  • 38

1 Answers1

0

You'll need to track the mouse yourself, as ckeditor doesn't give you the mouse event.

See this answer for details on that: How to get the mouse position without events (without moving the mouse)?

Community
  • 1
  • 1
Dusty J
  • 721
  • 6
  • 12