2014-11-03 95 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"); });