CKEditor 4 上传图片

参考资料:Basic Configuration

直接Ctrl+v(粘贴图片)报错信息:上传文件时发生网络错误(networkError:Network error occurred during file upload)

版本:4.11.4,API接口直接返回图片地址即可

CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here. For example:
    // config.language = 'fr';
    // config.uiColor = '#AADC6E';
    config.toolbarGroups = [
        { name: 'clipboard', groups: ['clipboard', 'undo'] },
        { name: 'editing', groups: ['find', 'selection', 'spellchecker', 'editing'] },
        { name: 'forms', groups: ['forms'] },
        { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] },
        { name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align', 'bidi', 'paragraph'] },
        { name: 'links', groups: ['links'] },
        { name: 'insert', groups: ['insert'] },
        { name: 'styles', groups: ['styles'] },
        { name: 'colors', groups: ['colors'] },
        { name: 'document', groups: ['document', 'doctools', 'mode'] },
        { name: 'tools', groups: ['tools'] },
        { name: 'others', groups: ['others'] },
        { name: 'about', groups: ['about'] }
    ];

  //移除的按钮 config.removeButtons
= 'Templates,Print,Find,Replace,SelectAll,Scayt,Checkbox,Form,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,CreateDiv,Blockquote,BidiLtr,BidiRtl,Flash,PageBreak,Iframe,About,ShowBlocks,Smiley,SpecialChar,HorizontalRule,CopyFormatting,RemoveFormat'; //上传图片窗口用到的接口 config.filebrowserImageUploadUrl = "https://192.168.0.1/api/ECategoryDetail/UploadImg"; config.filebrowserUploadUrl = "https://192.168.0.1/api/ECategoryDetail/UploadImg"; // 使上传图片弹窗出现对应的“上传”tab标签 config.removeDialogTabs = 'image:advanced;link:advanced'; //粘贴图片时用得到 config.extraPlugins = 'uploadimage'; config.uploadUrl = 'https://192.168.0.1/api/ECategoryDetail/UploadImg'; };

 留下的按钮样式如下图:

建议大家有条件的直接用谷歌,百度找了半天没有有用的资料。

 

posted @ 2019-05-21 16:23  大稳·杨  阅读(7404)  评论(0编辑  收藏  举报