Integrating CKEditor with Rails 3.2

后端 未结 12 1488
一整个雨季
一整个雨季 2021-02-02 04:27

Similar to Integrating CKEditor with Rails 3.1 Asset Pipline

I am trying to integrate ckeditor with my rails 3.2 application.<

12条回答
  •  囚心锁ツ
    2021-02-02 04:55

    Finally an easy working solution.

    Download the CKEditor Zip file, extract the files and place them in the sub directory “javascripts/ckeditor”, add the main JS file to the layout..

    javascript_include_tag 'ckeditor/ckeditor.js'
    

    ..and write a bit JavaScript code which replaces textareas by CKEditor instances:

    $(document).ready(function() {
       if ($('textarea').length > 0) {       
         var data = $('textarea');
         $.each(data, function(i) {
           CKEDITOR.replace(data[i].id);
         });     
       }  
    });
    

    Credit Source

提交回复
热议问题