# Rails, TinyMCE, and Blake Watters' plugin

**URL:** <https://www.ruby-forum.com/t/rails-tinymce-and-blake-watters-plugin/88580>\
**Category:** Rails\
**Created:** [March 12, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/rails-tinymce-and-blake-watters-plugin/88580 "2007-03-12T20:35:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcernelli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/73ab20/32.png) [@jcernelli](https://www.ruby-forum.com/u/jcernelli)\
**Post date:** [March 12, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/rails-tinymce-and-blake-watters-plugin/88580/1 "2007-03-12T20:35:33Z")

</div>

Hi,

I’ve been using your TinyMCE plug-in for Rails very happily for a while  
now. I’ve run into one problem that I just can’t seem to solve and I’m  
slowly going bats.

I want to allow users to paste in html forms into the TinyMCE editor. I  
realize the form tags are cleaned out prior to save in order to prevent  
XSS  
attacks, but after a lot of looking I found that TinyMCE will allow you  
to  
override what gets scrubbed out.

So I changed the default code for the controller (provided by the wiki  
example) from:

uses\_tiny\_mce(:options =\> {:theme =\> ‘advanced’,  
:browsers =\> %w{msie gecko},  
:theme\_advanced\_toolbar\_location =\> “top”,  
:theme\_advanced\_toolbar\_align =\> “left”,  
:theme\_advanced\_resizing =\> true,  
:theme\_advanced\_resize\_horizontal =\> false,  
:paste\_auto\_cleanup\_on\_paste =\> true,  
:theme\_advanced\_buttons1 =\> %w{formatselect  
fontselect fontsizeselect bold italic underline strikethrough  
separator justifyleft justifycenter justifyright indent outdent  
separator bullist numlist forecolor backcolor separator link unlink  
image undo redo},  
:theme\_advanced\_buttons2 =\> [],  
:theme\_advanced\_buttons3 =\> [],  
:plugins =\> %w{contextmenu paste}},  
:only =\> [:new, :edit, :show, :index])

To:

uses\_tiny\_mce(:options =\> {:theme =\> ‘advanced’,  
:browsers =\> %w{msie gecko},  
:extended\_valid\_elements =\>  
“form[name|id|action|method|enctype|accept-charset|onsubmit|onreset|target],input[alt|border|id|name|type|value|size|maxlength|checked|accept|src|width|height|disabled|readonly|tabindex|accesskey|onfocus|onblur|onchange|onselect],textarea[id|name|rows|cols|disabled|readonly|tabindex|accesskey|onfocus|onblur|onchange|onselect],option[name|id|value],select[id|name|type|value|size|maxlength|checked|accept|src|width|height|disabled|readonly|tabindex|accesskey|onfocus|onblur|onchange|onselect|length|options|selectedIndex]”,  
:theme\_advanced\_toolbar\_location =\> “top”,  
:theme\_advanced\_toolbar\_align =\> “left”,  
:theme\_advanced\_resizing =\> true,  
:theme\_advanced\_resize\_horizontal =\> false,  
:paste\_auto\_cleanup\_on\_paste =\> false,  
:theme\_advanced\_buttons1 =\> %w{formatselect  
fontselect fontsizeselect bold italic underline strikethrough  
separator justifyleft justifycenter justifyright indent outdent  
separator bullist numlist forecolor backcolor separator link unlink  
image undo redo},  
:theme\_advanced\_buttons2 =\> [],  
:theme\_advanced\_buttons3 =\> [],  
:plugins =\> %w{contextmenu paste}},  
:only =\> [:new, :edit, :show, :index])

Unfortunately, that’s not doing what is expected. In fact, it’s not  
doing  
anything at all. In desperation I went to the public/tiny\_mce.js  
directory  
and edited the extended\_valid\_elements attribute directly, but that had  
the  
same result… no change.

Anyone have any insights?

Joe

---

<div class="post-metadata">

**Author:** ![jcernelli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/73ab20/32.png) [@jcernelli](https://www.ruby-forum.com/u/jcernelli)\
**Post date:** [March 12, 2007, 8:39pm UTC](https://www.ruby-forum.com/t/rails-tinymce-and-blake-watters-plugin/88580/2 "2007-03-12T20:39:34Z")

</div>

> I’ve been using your TinyMCE plug-in for Rails very happily for a while  
> now. I’ve run into one problem that I just can’t seem to solve and I’m  
> slowly going bats.

So much for proof reading, was originally going to send this to Blake  
directly, but figured I’d ask the group first before bugging anyone. At  
any  
rate I’m using Blake’s great plugin for using TinyMCE found on the wiki  
here:  
[http://wiki.rubyonrails.org/rails/pages/HowToUseTinyMCE](http://wiki.rubyonrails.org/rails/pages/HowToUseTinyMCE)

Sorry about that, must not have had enough caffeine today!
