2

似乎无法弄清楚为什么 ckeditor 不再适用于heroku。它在我的本地机器上运行良好。

更新:当资产托管在 heroku 上时,无需asset_sync gem 即可工作 - 但不能使用它。

错误:Uncaught SyntaxError: Unexpected token < in config.js:1 ckeditor 找不到 config.js,< 是 404 未找到页面的开始标记 加载资源失败:服务器响应状态为 406(不可接受)

感谢我能得到的任何帮助。

ckeditor gem,Heroku,Rails 4,asset_sync

应用程序.js

//= require ckeditor/init
//= require ckeditor/config

gemfile - 版本 4.0.7

gem "ckeditor" 

应用程序.rb

config.autoload_paths += %W(#{config.root}/app/models/ckeditor)
config.assets.precompile += Ckeditor.assets
config.assets.precompile += %w(ckeditor/*)

生产.rb

config.assets.compile = true
config.action_controller.asset_host = "//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
4

3 回答 3

2

在资产版本更新时工作

于 2013-12-31T04:11:08.187 回答
1

基于https://github.com/galetahub/ckeditor#include-customized-ckeditor_basepath-setting我已经通过在 Heroku 上通过包含(在 ckeditor/init 之前)一个 ckeditor/basepath.js.erb 来修复加载 CKEditor 资产与asset_sync:

<%
  base_path = File.join Rails.application.config.action_controller.asset_host || '',
                    Rails.application.config.assets.prefix,
                   '/ckeditor/'
%>

(function() {
  if (typeof window['CKEDITOR_BASEPATH'] === "undefined" || window['CKEDITOR_BASEPATH'] === null) {
    window['CKEDITOR_BASEPATH'] = '<%= base_path %>';
  }
}).call(this);
于 2014-10-31T11:45:31.147 回答
0

这将在系统中更新资产版本时起作用。

于 2014-01-05T14:37:46.870 回答