Rails 4 ckeditor文件上传

我在我的rails projec中使用了ckeditor,我的图像上传有问题。 我不想要ckeditor所拥有的一切,我为它写了一些简单的config.js:

CKEDITOR.editorConfig = (config) -> config.language = 'pl' config.toolbar_Pure = [ '/', { name: 'basicstyles', items: [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, { name: 'paragraph', items: [ 'NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] }, { name: 'links', items: [ 'Link','Unlink' ] }, '/', { name: 'styles', items: [ 'Styles','Format','Font','FontSize' ] }, { name: 'colors', items: [ 'TextColor','BGColor' ] }, { name: 'insert', items: [ 'Image','Table','HorizontalRule','PageBreak' ] }, ] config.toolbar = 'Pure' true 

在我看来:

 = f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Pure'} } 

使用此配置,我没有从我的计算机中选择图像的按钮: 在此处输入图像描述

但是当我删除我的config.js并在视图集中时:

 = f.input :answer, label: false, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full'} } 

然后我有从我的电脑上传文件的按钮,一切正常。 现在我的目标是编辑我的config.js以使此文件上传工作。 请帮忙。

我将配置更改为:

 CKEDITOR.editorConfig = function(config) { config.language = 'pl'; config.filebrowserBrowseUrl = "/ckeditor/attachment_files"; config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files"; config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files"; config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures"; config.filebrowserImageBrowseUrl = "/ckeditor/pictures"; config.filebrowserImageUploadUrl = "/ckeditor/pictures"; config.filebrowserUploadUrl = "/ckeditor/attachment_files"; config.toolbar_Pure = [ '/', { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] }, { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl'] }, { name: 'links', items: ['Link', 'Unlink'] }, '/', { name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] }, { name: 'colors', items: ['TextColor', 'BGColor'] }, { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'PageBreak'] } ]; config.toolbar = 'Pure'; return true; }; 

并按预期工作