I used the gem to install ckeditor. As such there is no config.js in the project (there is in the actual gem folder that I don’t want to modify). The install did create a ckeditor.js in the config/initializers folder that would seem to be the correct place to put the tool bar definition. But everything I have tried to get that to work throws a variety of syntax or method not found errors. Has anyone had success with this? If so a quick example would be very helpful.
My current ckeditor.js is:
# Use this hook to configure ckeditor
if Object.const_defined?("Ckeditor")
Ckeditor.setup do |config|
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default), :mongo_mapper and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require "ckeditor/orm/active_record"
# Allowed image file types for upload.
# Set to nil or [] (empty array) for all file types
# config.image_file_types = ["jpg", "jpeg", "png", "gif", "tiff"]
# Allowed attachment file types for upload.
# Set to nil or [] (empty array) for all file types
# config.attachment_file_types = ["doc", "docx", "xls", "odt", "ods", "pdf", "rar", "zip", "tar", "swf"]
end
end
I have the same problem as yours. At first, I followed Config rails with asset pipeline but it doesn’t work for me. Then I realized that the author of that link only create a new style of toolbar. You need to call it in the view also. That means you need to add this line
to make it works.
In order to test if the config.js is working, you can check the source of your webpage to see whether assets/javascripts/ckeditor/config.js is added.
Another way to check is to edit the editor color by uncommenting this line:
config.uiColor = '#AADC6E'. If the color of the editor changes then it works.I also made a stupid mistake that I include the ckeditor js files two times: once in the application.js, once in the layouts/application.html.haml file. Don’t know whether this is the source of the problem or not. You can try.
Hope this helps.