CKEditor编辑器实例.lang未定义?

CKEditor编辑器实例.lang未定义?,ckeditor,Ckeditor,您好,我正在尝试对CKEDITOR 3.6.2的实现进行一些更改 通过删除“链接”对话框的“目标”选项卡中显示的“链接目标类型”下拉列表中除2个选项外的所有选项 我试图使用API实现这一点,但在第X=S.lang.dir行的dialog()方法中的minified core ckeditor.js文件中出现错误;编辑在哪里 在执行CKEDITOR.dialog(editor,'link')时,编辑器实例的.lang属性未定义,在查看调试“editor”对象时,我在任何地方都看不到lang对象,因

您好,我正在尝试对CKEDITOR 3.6.2的实现进行一些更改

通过删除“链接”对话框的“目标”选项卡中显示的“链接目标类型”下拉列表中除2个选项外的所有选项

我试图使用API实现这一点,但在第X=S.lang.dir行的dialog()方法中的minified core ckeditor.js文件中出现错误;编辑在哪里

在执行CKEDITOR.dialog(editor,'link')时,编辑器实例的.lang属性未定义,在查看调试“editor”对象时,我在任何地方都看不到lang对象,因此我不确定为什么会缺少它?我没有在我们最初的实现上工作,但据我所知,我们只添加了2个插件,没有更改ckeditor核心

这是我的密码:

for (var i in CKEDITOR.instances) {
    var editor = CKEDITOR.instances[i];
    var dialogObj = CKEDITOR.dialog(editor, 'link');
    var linkDialogTargetField = dialogObj.getContentElement('target', 'linkTargetType');
    // API didn't seem to have a more efficient approach than clearing all and re-adding the one we want
    linkDialogTargetField.clear();
    linkDialogTargetField.add('notSet', '<not set>');
    linkDialogTargetField.add('_blank', 'New Window (_blank)');
}

但我不喜欢这种方法,有人有什么想法吗?或者使用API实现相同结果的其他方法?

使用第二种方法,覆盖下拉项而不是拼接。

更改对话框内容的API是第二个示例。第一个不是你在任何关于CKEditor的示例或教程中都会看到的,我不知道你为什么认为这是正确的方法。可能是因为所有的示例都过时了,我将直接转到源代码
CKEDITOR.on('dialogDefinition', function (ev) {
    // Take the dialog name and its definition from the event
    // data.
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;

    // Check if the definition is from the dialog we're
    // interested on (the "Link" dialog).
    if (dialogName == 'link') {
        // Get a reference to the "Link target" tab.
        var targetTab = dialogDefinition.getContents('target');

        var targetField = targetTab.get('linkTargetType');
        // removing everything except the 1st (none set) & 3rd (new window) options from the dropdown
        targetField['items'].splice(1, 2);
        targetField['items'].splice(2, 3); // the array is reduced by splice, so we have to splice from [2] onwards not from [4]
    }
});