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!
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With