tags:

views:

33

answers:

1

I'm trying to find a way to programmatically set the position of a CKEditor dialog whenever a new one is opened up. The actual setting of the position part seems easy, but what I can't seem to figure out is how to trap the event of a new CKEditor dialog being created and shown.

I'm assuming it will be something along the lines of...

CKEDITOR.on('dialogCreated', function(e) { ... } );

But can't seem to actually find it in the documentation. Any hints/tips?

A: 

After spending several hours today, I was able to figure this out by complete luck. Dialog definitions can be manipulated at load time. Within your config.js file, add the following:

CKEDITOR.on('dialogDefinition', function(e) {
    var dialogName = e.data.name;
    var dialogDefinition = e.data.definition;

    dialogDefinition.onShow = function() {
        // Calculate your newX and newY ...
        this.move(newX, newY);
    }
}

If you want to adjust the position for a specific dialog you can use dialogName to test for it.

T. Stone