【问题标题】:Images in Actiontext Editor blinks or refreshes when entering into new line进入新行时,Actiontext Editor 中的图像会闪烁或刷新
【发布时间】:2020-08-22 12:16:49
【问题描述】:

我最近配置了 Actiontext 以在我的 Rails 6.0.0 应用程序上运行。一切正常,除了我的应用程序的 Actiontext 编辑器中的图像每次我按 Enter 进入新行时都会闪烁。可以参考下面的视频。

https://imgur.com/76QuZyW

我不确定如何解决此问题。会不会是配置错误的 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>  

【问题讨论】:

  • 你有可以分享的代码吗?
  • 我已经添加了我的代码,如果这是一个好的开始,请告诉我。我已准备好分享更多内容。

标签: ruby-on-rails ruby rails-activestorage actiontext


【解决方案1】:

在我从6.0.0.rc1 升级到6.0.3 后问题就消失了。

升级还升级了其他宝石。其中一些我认为是罪魁祸首:

-    rails (6.0.0)
-      actioncable (= 6.0.0)
-      actionmailbox (= 6.0.0)
-      actionmailer (= 6.0.0)
-      actionpack (= 6.0.0)
-      actiontext (= 6.0.0)
-      actionview (= 6.0.0)
-      activejob (= 6.0.0)
-      activemodel (= 6.0.0)
-      activerecord (= 6.0.0)
-      activestorage (= 6.0.0)
-      activesupport (= 6.0.0)
+    rails (6.0.3)
+      actioncable (= 6.0.3)
+      actionmailbox (= 6.0.3)
+      actionmailer (= 6.0.3)
+      actionpack (= 6.0.3)
+      actiontext (= 6.0.3)
+      actionview (= 6.0.3)
+      activejob (= 6.0.3)
+      activemodel (= 6.0.3)
+      activerecord (= 6.0.3)
+      activestorage (= 6.0.3)
+      activesupport (= 6.0.3)

【讨论】:

  • 当我从 6.0.0.rc1 迁移到 6.0.3 时,视频预览停止工作
  • 我很遗憾听到@Yshmarov 也许您可以打开一个新问题并分享您的代码?
  • 我已将其作为问题发布在这里github.com/rails/rails/issues/39348
猜你喜欢
  • 2017-09-22
  • 1970-01-01
  • 1970-01-01
  • 2021-12-03
  • 1970-01-01
  • 1970-01-01
  • 2014-06-09
  • 2015-07-26
  • 1970-01-01
相关资源
最近更新 更多