Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What WYSIWYG works well with jQuery and Ruby on Rails 3.1 (Sprockets)?

I am having trouble making any "common" WYSIWYG work with Rails. We even had to do one ourselves with RedCloth for the moment.

I tried to use tinymce-rails but couldn't make it work. Also tried nicEdit which worked but only when you called the online library (and also looks abandoned).

Has anyone worked with a good WYSIWYG that is jQuery and Rails 3.1 (Sprockets) friendly?

like image 502
ersamy Avatar asked Sep 02 '11 19:09

ersamy


Video Answer


3 Answers

I use ckeditor in my Rails 3.1 app.

Just throw the folder into you lib/assets/javascripts and whenever you need it reference it like this:

= javascript_include_tag "ckeditor/ckeditor.js"

And in javascript:

:javascript
  $(function(){
    CKEDITOR.replace( 'input',
      {
        // Optional params:
        skin : 'office2003',
        height: '700px'
      });
  })
like image 115
Plattsy Avatar answered Oct 13 '22 00:10

Plattsy


After struggling with this issue for quite awhile, I came up with a solution for using the standard tinyMCE with Rails 3.1 and the asset pipeline.

  1. I started with the tinyMCE jQuery package.
  2. Create a directory in vendor for tinyMCE: /vendor/assets/javascripts/tiny_mce
  3. Place only jquery.tinymce.js inside of /vendor/assets/javascripts/tiny_mce
  4. Place the remaining tinyMCE files in a directory in your /public/javascripts folder, inside of a directory called tiny_mce
  5. Add tinyMCE to your application.js like so:

    //=require jquery
    ...
    //=require tiny_mce/jquery.tinymce.js
    
  6. I initialize tinyMCE in my application.js as well, and set a script_url path to tell tinyMCE that it's supporting files now live in my public/javascripts/tiny_mce directory:

    $('.tinymce').each(function(i){
    $(this).tinymce({
      script_url : '/javascripts/tiny_mce/tiny_mce.js',
       ...
    

That should work. Now you are using the asset pipeline to load tinyMCE, and serving the supporting assets and javascripts from the public directory.

like image 33
jaeysin Avatar answered Oct 13 '22 00:10

jaeysin


The Mercury Editor looks promising. I'm planning to try it on my next rails project.

http://jejacks0n.github.com/mercury/

like image 23
Nvick Avatar answered Oct 13 '22 00:10

Nvick