kreativgebiet / rich

:money_with_wings: An opinionated CKEditor editor for Rails with flexible image uploads
MIT License
418 stars 238 forks source link

Rich not being displayed in Rails Admin #83

Open BartlomiejSkwira opened 11 years ago

BartlomiejSkwira commented 11 years ago

I use Rails Admin and I wanted to setup Rich with it. After bundle install I've run:

rails generate rich:install
rake db:migrate

I use Devise with model name Admin, so I modified /config/initializers/rich.rb:

config.authentication_method = :authenticate_admin!

Here is my model config in config/initializers/rails_admin.rb:

config.model Article do |a|

    edit do

      field :trailer_text, :rich_editor do
        config({
          :insert_many => true
        })
      end

      field :news_text, :rich_editor do
        config({
          :insert_many => true
        })
      end
    end
  end

Here is how it all looks like: untitled

Any ideas how to debug this would be great!

[edit]: now it started to display something, link names without styling, but still no editor: untitled2

hubertlepicki commented 11 years ago

Are both: Rich CSS and JavaScript files loaded?

BartlomiejSkwira commented 11 years ago

Strange, sometimes JavaScript is not loaded at all, and sometimes it loads assets/rich/base.js?body=1 with body:

// Wire up Rich

;
BartlomiejSkwira commented 11 years ago

I've inspected the inline JavaScript

var instance = CKEDITOR.instances['article_trailer_text'];
  if(instance) { CKEDITOR.remove(instance); }
  CKEDITOR.replace('article_trailer_text',....)

and run the code in console and this is what I got:

$ var a = CKEDITOR.instances['article_trailer_text']; => undefined
$ a = CKEDITOR.instances['article_trailer_text']; => a.editor {_: Object, elementMode: 1, element: d.element, name: "article_trailer_text", id: "cke_1"…}

var is somehow resposible? o.O

gonjay commented 11 years ago

I met the same problem in Rails 4 with rails_admin And here is what happened 2013-10-19 10 10 13

mdunbavan commented 10 years ago

Was there any fix to this issue? I am getting exactly the same error in active admin too

yasinishyn commented 8 years ago

I've merged this PR locally, and it helped for me.