Ckeditor上传图片功能消失了吗? - 铁路

时间:2015-10-29 21:24:01

标签: ruby ruby-on-rails-3 ruby-on-rails-4

我已经安装了ckeditor并且有一段时间它有图像上传功能,但现在它似乎不存在。

有什么东西我不知道吗?

我正在使用carrierwave + minimagick,我也为网站的另一部分安装了rmagick。我不认为这两者相关吗?

config.js

CKEDITOR.editorConfig = function( config ) {
  config.height = 800;
}

初​​始化器

Ckeditor.setup do |config|

  require "ckeditor/orm/active_record"

end

1 个答案:

答案 0 :(得分:1)

添加到初始化程序:

config.assets_plugins = ['image']

以及您的JS文件:

config.toolbar_Pure = [
    '/',{
      name: 'insert',
      items: ['Image']
    }
  ];

您可以在此处查看完整配置:

CKEDITOR.editorConfig = function(config) {
  config.language = 'en';
  config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
  config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
  config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
  config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
  config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
  config.filebrowserImageUploadUrl = "/ckeditor/pictures";
  config.filebrowserUploadUrl = "/ckeditor/attachment_files";
  config.toolbar_Pure = [
    '/', {
      name: 'basicstyles',
      items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat']
    }, {
      name: 'paragraph',
      items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl']
    }, {
      name: 'links',
      items: ['Link', 'Unlink']
    }, '/', {
      name: 'styles',
      items: ['Styles', 'Format', 'Font', 'FontSize']
    }, {
      name: 'colors',
      items: ['TextColor', 'BGColor']
    }, {
      name: 'insert',
      items: ['Image', 'Table', 'HorizontalRule', 'PageBreak']
    }
  ];
  config.toolbar = 'Pure';
  return true;
};