我已经按照 github (https://github.com) 上发布的说明在 Rails 3.2.3 中安装了 ckeditor 3.7.1 和 Paperclip gems (gem 'ckeditor', '3.7.1' gem 'paperclip')/galetahub/ckeditor)。这一切似乎都有效,除了当我尝试使用 ckeditor 生成的 html(包含上传的图像)通过 AccountMailer 发送电子邮件时,它给了我这个:
<img alt=3D"logo" src=3D"/assets/logo= .png" />
当我想要这个时:
<img alt=3D"logo" src=3D"www.mydomain.com/assets/logo= .png" />
我发现文档非常困惑,并且 gem 不提供对 config.js 的访问来修改 baseHref。我尝试更改 model/ckeditor 中的 Attachment_file.rb 和 picture.rb ,以便 url 包含域,但这会破坏上传功能。我也尝试过 ckeditor_rails 但这会删除上传功能,而且我没有时间 创建自定义浏览器和 uploader 。
感谢任何帮助。谢谢!
最佳答案
在 Ckeditor::Picture Model 中添加该函数
def url_content
if Rails.env.production?
host_url="http://your_domen"
else
host_url="http://localhost:3000"
end
host_url+url(:content)
end
关于paperclip - Ckeditor 3.7.1 + Paperclip(电子邮件中的绝对路径),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11108526/