繁体   English   中英

CKeditor select 默认情况下在图像对话框中的上传选项卡

[英]CKeditor select the upload tab in image dialog by default

有没有办法修改 CKEditor 的图像对话框以默认显示上传选项卡而不是图像信息选项卡?

我尝试通过在对话框的 onload 中添加一行代码来做到这一点:

onLoad: function() {
    this.getDialog().selectPage('Upload');
}

这似乎工作正常,我可以将图像上传到服务器,但是一旦我点击确定按钮,我就会收到权限被拒绝错误。

我也尝试过CKSource 描述的方式,但这给了我一个例外,因为它覆盖了 onShow 方法。

通过添加this.selectPage('Upload');了这个问题到图片插件的onShow function结束

如您所见,文档中的示例已损坏,因为 Image 插件已经具有 onShow() 方法。

诀窍是像这样链接方法:

CKEDITOR.on('dialogDefinition', function(e) {
    if (e.data.name == 'image') {
        var dialog = e.data.definition;
        oldOnShow = dialog.onShow;
        dialog.onShow = function() {
             oldOnShow.apply(this, arguments);
             this.selectPage('Upload');
        };
    }
});

该文档说明了如何在 ckeditor 配置中默认设置对话框选项卡:

http://docs.cksource.com/CKEditor_3.x/Howto/Default_Dialog_Tab

可以用户遵循脚本。

<script type="text/javascript">

    CKEDITOR.on('dialogDefinition', function(ev) {

    var dialogName = ev.data.name;
    var dialogDefinition = ev.data.definition;

    if (dialogName == 'image') {
        dialogDefinition.onShow = function () {
            // This code will open the Upload tab.
            this.selectPage('Upload');
        };
    }
});
</script>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM