TinyMCE:Ruby on Rails

From Moxiecode Documentation Wiki

Jump to: navigation, search

To integrate TinyMCE into a Ruby on Rails application, there's the tiny_mce plugin by Blake Watters. This plugin makes TinyMCE available to all textareas for the controllers and actions you choose. For an installation guide, see "HowToUseTinyMCE" in the the Rails wiki.

To install:

ruby script/plugin install -x https://secure.near-time.com/svn/plugins/trunk/tiny_mce

The most crucial thing to keep in mind is to include the TinyMCE javascript library before the scriptaculous library in your layout or view (see the scriptaculous wiki). The best order seems to be:

  1. prototype.js
  2. tiny_mce.js
  3. scriptaculous.js
  4. tinyMCE.init({ ...options... })

If you don't want to/didn't manage to install the plugin, you can just download the javascript files to public/javascripts/tiny_mce and invoke TinyMCE the normal way in the head of the layout file for the views where you want to use it.


For integrating TinyMCE with the ajaxscaffold generator, see here.


Although TinyMCE does some HTML sanitizing, it's not advisable to rely on that because it can be easily circumvented (remember, it's just a client-side script). Better use something like technoweenie's white_list plugin.

More Rails stuff for TinyMCE:

Personal tools