我在我的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; };
并按预期工作
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。