CKEditor 3对话框定位 [英] CKEditor 3 Dialog Positioning
问题描述
我已经检查并尝试张贴在这里的方法来设置CKEditor对话框弹出的位置:
I have checked and tried the method posted here to set where CKEditor dialogs pop up:
这似乎已经过时了,不完全。当为链接对话框尝试此操作时,对话框的格式不正确,就像此onShow定义替换默认操作而不是添加到它。
This seems to either be deprecated or incomplete. When attempting this for the 'link' dialog, the dialog box does not format correctly, as if this onShow definition replaces the default action rather than adding to it. Any suggestions to alter this code or a new method to position the link dialog closer to the menu bar?
CKEDITOR.on('dialogDefinition', function(e) {
var dialogDefinition = e.data.definition;
dialogDefinition.onShow = function() {
this.move(200, 100);
}
})
推荐答案
你是对的。你的代码覆盖了基本的 onShow
定义。
You're right. Your code is overwriting the basic onShow
definition.
你必须做的只是保存默认) onShow
,然后覆盖它,以便它调用保存的一个并最终执行您的代码:
What you have to do is simply to save a default (generic) onShow
, then overwrite it so it calls the saved one and eventually executes your code:
CKEDITOR.on( 'dialogDefinition', function( event ) {
var dialogDefinition = event.data.definition,
genericOnShow = dialogDefinition.onShow;
dialogDefinition.onShow = function() {
genericOnShow.apply( this );
this.move( 10, 10 );
// ...or anything you want ;)
}
});
Voilà!
PS. Remember to always pass the context with apply or call.
这篇关于CKEditor 3对话框定位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!