我使用带有CKEditor gem (https://github.com/galetahub/ckeditor)的CKEditor,并且一切正常,直到我尝试添加自定义工具栏。
一些帖子建议使用config.js文件。然而,按照说明设置后,
是否有一种方法可以通用地自定义工具栏?或者即使我只能内联地缩小选项,这也将很有帮助...
使用Rails 3.2.11
在我的Gemfile中:
在 application.rb 中,我有以下内容:
在 application.js 文件中,我有以下内容:
一些帖子建议使用config.js文件。然而,按照说明设置后,
app/assets/javascripts
中没有/ckeditor/config.js
文件。此外,即使在javascript目录中添加/ckeditor/config.js
,文件上传功能也会停止工作。即使config.js
是一个空文件,服务器重新启动后,“上传”选项卡也将变为隐藏和无法使用。是否有一种方法可以通用地自定义工具栏?或者即使我只能内联地缩小选项,这也将很有帮助...
使用Rails 3.2.11
在我的Gemfile中:
gem "jquery-rails", "~> 2.2.1"
gem "ckeditor"
gem "carrierwave"
gem "mini_magick"
gem "cloudinary"
在 application.rb 中,我有以下内容:
config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
在 application.js 文件中,我有以下内容:
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require ckeditor/init
//= require_tree ../../../vendor/assets/javascripts/.
//= require_tree .
在我的表单中,我有:
= f.cktext_area :content
我尝试使用的config.js文件:
CKEDITOR.editorConfig = function( config ) {
config.toolbar_Custom = [
{ name: 'document', items : [ 'Source','-','Save','NewPage','DocProps','Preview','-','Templates' ] },
{ name: 'clipboard', items : [ 'PasteFromWord','-','Undo','Redo' ] },
{ name: 'insert', items : [ 'Image','Table','HorizontalRule','SpecialChar','PageBreak' ] },
{ name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] },
'/',
{ 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','Anchor' ] },
'/',
{ name: 'styles', items : [ 'Styles','Format','Font','FontSize' ] },
{ name: 'colors', items : [ 'TextColor','BGColor' ] }
];
config.toolbar = 'Custom';
};