以编程方式设置 CKEditor 对话框的位置

发布于 2024-09-12 20:19:33 字数 229 浏览 10 评论 0原文

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

我假设它会类似于...

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

但似乎无法在文档中实际找到它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

救赎№ 2024-09-19 20:19:33

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

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 来测试它。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文