以编程方式设置CKEditor对话框的位置 [英] Programmatically set the position of CKEditor's dialogs

查看:66
本文介绍了以编程方式设置CKEditor对话框的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方法,以便在每次打开新对话框时以编程方式设置CKEditor对话框的位置。位置部分的实际设置似乎很容易,但是我似乎无法弄清楚是如何捕获创建和显示新CKEditor对话框的事件。

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.

推荐答案

今天度过了几个小时,我完全有幸解决了这个问题。对话框定义可以在加载时进行操作。在您的 config.js 文件中,添加以下内容:

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

如果要调整特定对话框的位置,可以使用 dialogName 进行测试

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

这篇关于以编程方式设置CKEditor对话框的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆