Search code examples
rubyruby-on-rails-3ruby-on-rails-4

Ckeditor upload image functionality disappeared? - Rails


I have installed ckeditor and for a while it had image upload functionality but now it seem absent.

Is there something that i do not know?

I am using carrierwave + minimagick, i also have rmagick installed for another part of the site. i do not think that these two correlate?

config.js

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

intializer

Ckeditor.setup do |config|

  require "ckeditor/orm/active_record"

end

Solution

  • add to your initializer:

    config.assets_plugins = ['image']
    

    and to your JS file:

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

    you can see full configuration here:

    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;
    };