- Notifications
You must be signed in to change notification settings - Fork1
Integration of TinyMCE with the Rails 3.1 asset pipeline
License
rekomendme/tinymce-rails
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Thetinymce-rails
gem integrates theTinyMCE editor with the Rails 3.1 asset pipeline.
1. Addtinymce-rails
to your Gemfile
gem 'tinymce-rails'
Then runbundle install
.
2a. Use TinyMCE with the jQuery extension
Add to your application.js:
//= require tinymce-jquery
and use TinyMCE in your view:
<%= text_area_tag :editor, "", :rows => 40, :cols => 120 %><script type="text/javascript"> $(function() { $('textarea').tinymce({ theme: 'advanced' }); });</script>
2b. Use TinyMCE without jQuery
Add to your application.js:
//= require tinymce
Use TinyMCE in your view:
<%= text_area_tag :editor, "", :rows => 40, :cols => 120 %><script type="text/javascript"> tinyMCE.init({ mode: 'textareas', theme: 'advanced' });</script>
To use custom plugins or skins, simply add the files to your asset load path so that they are locatable at a path beneathtinymce/plugins/
ortinymce/themes/advanced/skins/
.
For example, a plugin calledmycustomplugin
could have its main JS file atapp/assets/javascripts/tinymce/plugins/mycustomplugin/editor_plugin.js
.
Any files with a path beginning withtinymce/
will be automatically precompiled.
When new versions of TinyMCE are released, simply update thetinymce-rails
gem to the latest version. There is no need to run any extra rake tasks (apart fromrake assets:precompile
).