我在我的rails项目中使用了ckeditor,我的图像上传有问题.
我不想要ckeditor所拥有的一切,我为它写了一些简单的config.js:
我不想要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'} }
使用此配置我没有从我的计算机中选择图像的按钮:
= f.input :answer,:input_html => { :ckeditor => {:toolbar => 'Full'} }
解决方法
我将配置更改为:
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','RemoveFormat'] },{ name: 'paragraph',items: ['NumberedList','BidiRtl'] },{ name: 'links',items: ['Link','Unlink'] },{ name: 'styles',items: ['Styles','FontSize'] },{ name: 'colors',items: ['TextColor','BGColor'] },{ name: 'insert',items: ['Image','PageBreak'] } ]; config.toolbar = 'Pure'; return true; };
并按预期工作