我最近将 Actiontext 配置为在我的 Rails 6.0.0 应用程序上工作。一切正常,除了我的应用程序的 Actiontext 编辑器中的图像每次我按 Enter 进入新行时都会闪烁。可以参考下面的视频。
我不确定如何解决这个问题。会不会是配置错误的 Actiontext 或 ActiveStorage?
编辑:
这是我的代码,
// javascript/packs/application.js
require("trix")
require("@rails/actiontext")
/* assets/stylesheets/application.scss */
//=require actiontext
/* assets/stylesheets/actiontext.scss */
@import "trix/dist/trix";
.trix-content {
.attachment-gallery {
> action-text-attachment,
> .attachment {
flex: 1 0 33%;
padding: 0 0.5em;
max-width: 33%;
}
&.attachment-gallery--2,
&.attachment-gallery--4 {
> action-text-attachment,
> .attachment {
flex-basis: 50%;
max-width: 50%;
}
}
}
action-text-attachment {
.attachment {
padding: 0 !important;
max-width: 100% !important;
}
}
}
# app/models/card.rb
class Card < ApplicationRecord
has_rich_text :answer
end
<%# app/views/cards/_form.html.erb %>
<div class="form-group">
<%= f.label :answer %>
<%= f.rich_text_area :answer %>
</div>