编程设置CKEditor对话框的位置 [英] Programatically set the position of CKEditor's dialogs
问题描述
我试图找到一种方法,以编程方式设置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. Any hints/tips?
推荐答案
今天花了几个小时后,我完全可以算出这一点。对话框定义可以在加载时进行操作。在您的 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屋!