简体   繁体   中英

Fail to integrate CKeditor in rails_admin gem (use gem rich)

I follow the link GitHub gem rich to install CKeditor to rails_admin but I get the error: Unsupported field datatype: rich_editor

My model

edit do
        field :title
        field :description, :rich_editor do
          config({
            :insert_many => true
          })
        end
        field :autho
        field :book_type
      end

How can I fix this error? Or that's an issue?


EDIT : I tried it, and it worked

field :content, :text do
      ckeditor do true end
end

I couldn't get the Rich gem to work with a Rails 4 project using Rails admin, so I decided to use the standard CK Editor Gem which is the recommended course of action by the authors. It took all of 5 minutes to get it working following this:

https://github.com/sferik/rails_admin/wiki/CKEditor

Then I configured my CK_Editor to use a small subset of the available functionality.

After adding the CK_Editor gem and configuring my rails admin initializer, I created a new javascript file in my project at:

/app/assets/javascripts/ckeditor/config.js

with the following contents:

CKEDITOR.config.toolbar = [
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ],
    items: [ 'Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ],
    items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote',
         'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
{ name: 'links', items: [ 'Link', 'Unlink' ] },

];

Remember to restart your Rails server!

I have the same issue. I think it is an issue in rails_admin or in rich. I have successfully integrate these two together in past (but with old versions of both).

I have created github issues for this in rich ( https://github.com/bastiaanterhorst/rich/issues/80 ) and rails_admin ( https://github.com/sferik/rails_admin/issues/1585 ) repos.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM