Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WYSIWYG editor gem for Rails? [closed]

Is there a good ruby gem for a WYSIWYG editor that will easily work with a rails app?

like image 236
wusher Avatar asked Aug 23 '08 20:08

wusher


3 Answers

Though it's certainly not a direct answer, in the past I've found I prefer to use RedCloth (or a Markdown parser if you don't enjoy Textile) and use a simple textarea with an AJAXy preview. Generally speaking, WYSIWYG editors have a long history of creating redundant tags and similar, leading to potentially broken pieces of HTML.

like image 71
wfarr Avatar answered Oct 05 '22 02:10

wfarr


While I know this has been answered I wanted to add regarding the use of textile... I completely agree, but I'd recommend processing it in a before_save filter. Let's say you have a database field called "details" - just add one called "details_html". Then do something like this...

before_save :convert_details

def convert_details
  return if self.details.nil?
  self.details_html = RedCloth.new(self.details).to_html
end

RedCloth can get a little process heavy and if you are constantly processing the stuff on each render you're going to run into some memory issues... this will just help lower some of your needed resources.

like image 21
Tim Knight Avatar answered Oct 05 '22 02:10

Tim Knight


Update for 2010. I just implemented TinyMCE in a Rails app using the tinyMCE gem.

You can find it here: http://github.com/kete/tiny_mce

It took less than 5 minutes and in my basic testing, it's working perfectly. There was a commit in June 2010, so it looks like this is an actively developed gem.

Hope that helps some googlers.

like image 30
MikeH Avatar answered Oct 05 '22 03:10

MikeH