2014-11-03 93 views
1

我希望我的用户能够将图像链接(不是上传的文件)添加到ckeditor字段并显示实际图像(IMG标签)。我似乎无法弄清楚如何做,上传效果很好,但这不是我所追求的。CKEditor中的图像链接

难道有人指着我正确的方向吗?

回答

1

试试这个插件:ckeditor.com/addon/base64image

  1. 下载https://github.com/nmmf/base64image/archive/master.zip
  2. 提取文件夹base64image到文件夹的CKEditor /插件
  3. 到HTML代码编写你的HTML元素编辑器和脚本:

    CKEDITOR.replace('editor1',{toolbar:['name:'about',items:['base64image','About']},], extraPlugins:'base64image' });

4.如果要禁用文件浏览,评论此行的文件/base64image/dialogs/base64image.js:

/*{ 
       type: "hbox", 
       widths: ["70px"], 
       children: [ 
        { 
         type: "checkbox", 
         id: "filecheckbox", 
         style: "margin-top:5px", 
         label: editor.lang.common.upload+":" 
        }, 
        { 
         type: "file", 
         id: "file", 
         label: "", 
         onChange: function(){ imagePreview("file"); } 
        } 
       ] 
      },*/ 

//fileCB = this.getContentElement("tab-source", "filecheckbox"); 

//fileCB.getInputElement().on("click", function(){ imagePreview("file"); });