Rich text editor for Active Admin using wysihtml5.
Rich text editor for Active Admin using wysihtml5.
This is a wysiwyg html editor for the Active Admin interface using wysihtml5.
Add the following to your Gemfile:
gem 'active_admin_editor'And include the wysiwyg styles in your application.css:
//= require active_admin/editor/wysiwygThen run the following to install the default intializer:
$ rails g active_admin:editorThis gem provides you with a custom formtastic input called :html_editor to build out a wysihtml5 enabled input.
All you have to do is specify the :as option for your inputs.
Example
ActiveAdmin.register Page do
form do |f|
f.inputs do
f.input :title
f.input :content, as: :html_editor
end
f.buttons
end
endThe editor supports uploading of assets directly to an S3 bucket. Edit the initializer that
was installed when you ran rails g active_admin:editor.
ActiveAdmin::Editor.configure do |config|
config.s3_bucket = ''
config.aws_access_key_id = ''
config.aws_access_secret = ''
# config.storage_dir = 'uploads'
endThen add the following CORS configuration to the S3 bucket:
*
PUT
POST
GET
HEAD
3000
Location
*
You can configure the editor in the initializer installed with rails g active_admin:editor or you can configure the editor during
ActiveAdmin.setup:
ActiveAdmin.setup do |config|
# ...
config.editor.aws_access_key_id = ''
config.editor.s3_bucket = 'bucket'
endParser rules can be configured through the initializer:
ActiveAdmin::Editor.configure do |config|
config.parser_rules['tags']['strike'] = {
'remove' => 0
}
endBe sure to clear your rails cache after changing the config:
rm -rf tmp/cacheSince some of the javascript files need to be compiled with access to the env vars, it's recommended that you add the user-env-compile labs feature to your app.
Tell your rails app to run initializers on asset compilation
# config/environments/production.rb
config.initialize_on_precompile = trueAdd the labs feature
heroku labs:enable user-env-compile -a myappgit checkout -b my-new-feature)git commit -am 'Added some feature')git push origin my-new-feature)Run RSpec tests with bundle exec rake. Run JavaScript specs with bundle exec rake konacha:serve.
No open issues yet, or sync has not completed.