Programmatically set the position of CKEditor's dialogs

前端 未结 1 1284
心在旅途
心在旅途 2021-01-21 07:51

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 wha

1条回答
  •  梦毁少年i
    2021-01-21 08:37

    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.

    0 讨论(0)
提交回复
热议问题