Ckeditor不在生产中显示Rails

时间:2017-02-02 04:05:16

标签: javascript ruby-on-rails ckeditor ruby-on-rails-5

所以我将Ckeditor更新为4.2。在我这样做之后,Ckeditor不再出现在制作中。相反,我在控制台中收到以下错误:

Uncaught TypeError: CKEDITOR.style.customHandlers[e.type] is not a constructor

我咨询了一些来源,包括post,其中声称问题出在预编译中。我编辑了我的application.rb以在预编译中包含Ckeditor,但它仍然不起作用。

require_relative 'boot'

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)


module DeployTest
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.
    config.assets.precompile += Ckeditor.assets
    config.assets.precompile += %w( ckeditor/* )
    config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
    config.active_record.default_timezone = :local
    config.time_zone = 'Eastern Time (US & Canada)'
  end
end

奇怪的是,当我转向config.assets.debug = true时,Ckeditor再次开始工作,但我的CSS关闭了。

为什么config.assets.debug有效?为什么关闭我的CSS?我怎样才能获得ckeditor的永久解决方案?

1 个答案:

答案 0 :(得分:0)

使用git中的ckeditor gem为我解决了这个问题

的Gemfile:

gem 'ckeditor', github: 'galetahub/ckeditor'

https://github.com/galetahub/ckeditor/issues/719