【问题标题】:Trix editor isn't working in Heroku, but working fine on localhostTrix 编辑器在 Heroku 中不工作,但在 localhost 上工作正常
【发布时间】:2019-09-30 02:59:46
【问题描述】:

我以前使用过 trix 编辑器,但这次在部署到 heroku 时并没有按计划工作。编辑器不显示,输入缩小为一个小方块,不可点击。

这是 localhost 上的预期行为: Trix editor showing up and working 但是,在heroku上,它显示如下: Trix editor not showing and not clickable as well

在我的轨道上 Gemfile:

gem 'trix-rails', require: 'trix'

在 application.scss 上:

 *= require_tree .
 *= require_self
 *= require font-awesome
 *= stub scaffolds
 */
 @import "trix";
 @import "font-awesome";

在 application.js 上:

//= require rails-ujs
//= require turbolinks
//= require_tree .
//= require trix

我的 _form.html.erb 上有以下代码:

<div class="field" id="blog-editor">
  <%= form.label :content %>
  <%= form.trix_editor :content, id: :backoffice_blog_content %>
</div>

我找不到问题出在哪里。到目前为止,我已经尝试过预编译资产,但找不到任何答案。

【问题讨论】:

标签: ruby-on-rails heroku rubygems trix


【解决方案1】:

控制台日志显示了一系列关于 Jquery 的错误。由于导入顺序,它无法正常工作(我使用的是 require 树,并且按字母顺序,一个文件需要另一个在它之后编译的文件)。基本上,你不应该在同一个项目中混合使用 sprockets 指令、sass 和其他形式的导入。 (这不是我的错,这是一个遗留项目)

但就是这样,解决了问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-12
    • 2017-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-28
    相关资源
    最近更新 更多