Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

good Rails 3 WYSIWYG editor? [closed]

I'm looking to add an editor to my app, similar to the one on Stackoverflow. I really just need some basic formatting (line spacing, bold, bullets etc.) and the ability to distinguish code (same style as SO).

Anyone know of any good solutions for this?

Thanks!

like image 581
Elliot Avatar asked Jan 04 '11 13:01

Elliot


3 Answers

tinyMCE, NicEdit, WYMeditor and Redactor are possible options. StackOverflow itself uses WMD Editor, but it is hard to find an up-to-date repository for it. If you use Twitter's Bootstrap framework, then bootstrap-wysihtml5 is a good choice.

For TinyMCE there are suitable Ruby gems which facilitate the integration in Rails, namely tinymce-rails and tinymce-rails-imageupload.

CKEditor, the former FCKeditor, is one of the most popular WYSIWYG editors.

like image 164
0x4a6f4672 Avatar answered Nov 18 '22 06:11

0x4a6f4672


I suggest to use tinyMCE

Its Simple to use, what you have to do just add <%= f.text_area :body, :rows => 20, :cols => 100, value: @some_object.body ? @some_object.body : '' %>

And use this inline script on that page itself:

<script type="text/javascript">
  tinyMCE.init({
    mode: 'textareas',
    theme: 'advanced',
    theme_advanced_toolbar_location : "top",
    theme_advanced_buttons1 : "bold,italic,underline,separator,justifyleft,justifycenter,justifyright, justifyfull,forecolor,backcolor,formatselect,fontselect,fontsizeselect, link,unlink, image"
  });
</script>

As mention your just required only basic formatting so just changed theme_advanced_buttons.

like image 44
prasad_g Avatar answered Nov 18 '22 05:11

prasad_g


I would definitely urge you to try Wysihat-Engine. It solved my problem of finding a simple wysiwyg editor for my app. Its seamless, even more if you're using paperclip. Its a wrapper around the 'WYSIHAT' written by 37signals.

like image 1
Shreyas Avatar answered Nov 18 '22 06:11

Shreyas