-
Notifications
You must be signed in to change notification settings - Fork 640
Replacing default WYSIWYG editor with TinyMCE 4
Tom Hensel edited this page Apr 6, 2014
·
8 revisions
!!! TineMCE-4 is work in progress, please be very careful applying this to a production setup. Better go for TinyMCE-3.
- Add this to your Gemfile:
gem 'tinymce-rails', :git => '[email protected]:spohlenz/tinymce-rails.git', :branch => 'tinymce-4'
- Optionally, add i18n support:
gem 'tinymce-rails-langs', :git => '[email protected]:spohlenz/tinymce-rails-langs.git', :branch => 'tinymce-4'
- Include assets accordingly in
app/assets/javascripts/application.js
(we are going to use the jquery version):
//= require tinymce
- Run bundler:
$ bundle install
- Create coffeescript file at
app/assets/javascript/comfortable_mexican_sofa/admin/application.js.coffee
:
#= require tinymce
window.CMS.wysiwyg = ->
tinymce.init
selector: 'textarea[data-cms-rich-text]'
# any additional tinymce configuration can go here
- tinymce-rails-langs will use the current locale. You may set
language
to override:
# any additional tinymce configuration can go here
language: 'de'
- Optionally enable plugins (please see the TinyMCE documentation for further info):
plugins: 'autosave anchor image charmap contextmenu fullscreen link paste preview print visualchars'
- Delete
app/assets/javascript/comfortable_mexican_sofa/admin/application.js
if it exists. If you have stuff defined in there you need to migrate it to coffeesript as comfy will use that first (and exclusivley then).