I am working on a Rails 6 application with Ubuntu 18.
I just installed ActionText for the Trix Editor (what you see is what you get), so that I can save text to the database which can be modified by an admin, however, when I add an image using the Trix Editor if I don't specify a caption for the image, it shows the name and size of the image as the caption
I just want to remove the captions, and only have the captions when I specify them myself.
I later figured out how to do it.
After successfully installing ActionText:
rails action_text:install
And successfully setting it up:
// application.js
require("trix")
require("@rails/actiontext")
// actiontext.scss
@import "trix/dist/trix";
Modify these lines of code in app/views/active_storage/blobs/_blob.html.erb
from this:
<span class="attachment__name"><%= blob.filename %></span>
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
to this
<span class="attachment__name"><% blob.filename %></span>
<span class="attachment__size"><% number_to_human_size blob.byte_size %></span>
That is, remove the =
sign from the both lines of code, so that the name and size of the image is not displayed as the caption when a caption is not specified.
That's all.
I hope this helps