The redactor-rails gem integrates the Redactor editor with the Rails 3.2 asset pipeline.
Add this line to your application's Gemfile:
gem 'redactor-rails'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install redactor-rails
gem "carrierwave"
gem "mini_magick"
$ rails generate redactor:install
$ rake db:migrate
Create a config/redactor.yml
file with your global configuration options, like:
lang: 'zh_tw'
autoresize: true
buttons:
- html
- '|'
- formatting
- '|'
- bold
- italic
If You Want To setup a new language in Redactor you should do two things:
In you global configuration config/redactor.yml
set option
lang: 'zh_tw'
and
Add to your layout
<%= redactor_lang('zh_tw') %>
See the Redactor Documentation for a full list of configuration options.
Add to your application.js
:
//= require redactor-rails
Add to your application.css
:
*= require redactor-rails
For each textarea that you want to use with Redactor, add the "redactor" class and ensure it has a unique ID:
<%= text_area_tag :editor, "", :class => "redactor", :rows => 40, :cols => 120 %>
Then invoke the redactor
helper to initialize Redactor:
<%= redactor %>
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
redactor-rails
part of reference galetahub/ckeditor project.
redactor-rails
uses MIT-LICENSE. Rock!!!!!
the redactor-rails
project is MIT-LICENSE.
You may use Redactor
for non-commercial websites for free, however, we do not guarantee any technical support.
Redactor has 3 different licenses for commercial use. For details please see License Agreement.