I’m using the current TinyMCE plugin for rails (V. 3.2.0.2-1). I want
to know if there is a way to use different options for the editor in a
single controller depending on the action invoked. I’ve tried re-
invoking the uses_tiny_mce declaration in the individual actions,
e.g.
As you’ll see in the link above, it sets an instance variable used later
in
the view helpers. The last declaration of uses_tiny_mce will overwrite
that
variable.
However, the view helpers can take a different set of options. So you
can do
something like this in application.html.erb:
if params[:action] == “edit_small”
tiny_mce_init(edit_small_options)
elsif params[:action] == “edit_big”
tiny_mce_init(edit_big_options)
else
tiny_mce_init # use whatever options specified in the controller
end
Having a look at it now, I see I missed a couple of places for passing
those
options (for example include_tiny_mce_if_needed(edit_big_options) isn’t
possible), so for now (until I get a chance to push some changes), to
stop
including tiny_mce unnessesarily, wrap the tiny_mce code in an
using_tiny_mce? conditional, like so