如何更改ckeditor对话框默认选项卡?

时间:2013-01-18 01:15:39

标签: javascript ckeditor

代码已经完成,但只能在第一次工作

if (dialogName == 'image') {
    dialogDefinition.removeContents('upload');
    dialogDefinition.removeContents('advanced');
    dialogDefinition.removeContents('Link');

    var infoTab = dialogDefinition.getContents('info');
    infoTab.remove('txtAlt');
    infoTab.remove('txtBorder');
    infoTab.remove('txtHSpace');
    infoTab.remove('txtVSpace');
    infoTab.remove('cmbAlign');

    dialogDefinition.onLoad = function () {
        this.selectPage('Upload');
    };
}

如果我不刷新页面,请单击“图像”按钮两次,而不是“上传”。 需要一些帮助,tks

1 个答案:

答案 0 :(得分:0)

您可以将此代码放在config.js中:

CKEDITOR.on('dialogDefinition', function (ev) {
    // Take the dialog window name and its definition from the event data.
    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;
    if (dialogName == 'link') {
        dialogDefinition.removeContents('advanced'); //remove advanced tab

        var infoTab = dialogDefinition.getContents('info');
        var urlField = infoTab.get('url');
        urlField['default'] = 'www.ireadhome.com'; //set default value for the url field
    }
});