将Rails 3.2与CKEditor集成:无法加载资源:Skins包

时间:2013-05-27 06:25:11

标签: ruby-on-rails ruby ruby-on-rails-3.2 ckeditor

将Rails应用程序与CKEditor集成时遇到问题。我遵循了从thread获得的指示。我将提取的文件夹(ckeditor)复制到 / assets / javascript ,然后在我的页面上添加这样的一行

<script type="text/javascript">
   var CKEDITOR_BASEPATH = '/assets/ckeditor/';
</script>

但是,当我打开浏览器时,我的Javascript控制台上出现了这样的错误

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:3000/assets/ckeditor/skins/office2003/skin.js?t=D3NA

Failed to load resource: the server responded with a status of 404 (Not Found)  http://localhost:3000/assets/ckeditor/skins/office2003/editor.css?t=D3NA

我使用Rails 3.2并下载了最新版本的CKEditor 4.1.1

任何建议?

3 个答案:

答案 0 :(得分:1)

啊,我的不好,我没有在我的页面上添加以下JS脚本

<script type="text/javascript">
   $(function(){
    CKEDITOR.replace( 'editor',
      {
        // Optional params:
        skin: 'office2003' // I change it to 'moono' and everything works well
        height: '300px'
      });
  })
</script>

答案 1 :(得分:0)

config.js:

CKEDITOR.editorConfig = function (config) {
    config.extraPlugins = 'syntaxhighlight';
    config.skin = 'office2003'; //tested OK
    config.toolbar = 
   [..................]
};

答案 2 :(得分:0)

The way it worked for me:

  1. Download the skin from Here.
  2. Place it under ckeditor/skins folder, if you dont have skins folder then create one.
  3. Add below line to ckeditor/config.js file.

    CKEDITOR.editorConfig = function (config) { config.skin = 'bootstrapck'; }

  4. Add //= require_tree ./ckeditor to your application.js file. you might have to write //= require_tree . before //= require_tree ./ckeditor. I am not sure why but without this line other javascripts are not getting loaded properly. Also, if you change the order it won't load editor properly.