We've moved discussions to Discord

Attachment Icon not Working in Trix

Ryan Chin
I have a form with Trix working, except the attachment icon - every other icon works.  For some reason when I click it, nothing happens.  I'm able to drag things into the field, but the attachment icon should allow people to select the file, too (like here).

I followed the instructions from the first GoRails Action Text video.

My code form code is simple:

<%= form_with(model: post, local: true) do |f| %>
    <div class="form-group"> <%= f.label :title, "Title" %> <%= f.text_field :title, autocomplete: "title", placeholder: "Title", class: "form-control" %> </div>
    <div class="form-group"> <%= f.label :content, "Body" %> <%= f.rich_text_area :content, autocomplete: "body", placeholder: "What's on your mind?", class: "form-control" %> </div>
    <div class="form-group"> <%= f.submit "Submit", class: "btn btn-primary", data: { disable_with: "Submitting..." } %> </div> <% end %>
Chris Oliver
Working here on the forums which is just a rich_text_field.

Any Javascript errors?
Ryan Chin
Chris Oliver

The only thing I see are warnings, and they don't seem to be related.  Here's a video.
Ryan Chin
I realized that the dropdown menu in the upper right hand corner doesn't work either.  So maybe non of my JS is working now.  I'm wondering if I overwrote something I shouldn't have when I went thru the GoRails episode for Action Text.  I didn't realize that Action Text and Active Storage were already there, so I replicated the steps of installing those and Stimulus.
Ryan Chin
I managed to fix the dropdowns.  controllers > index.js got overwritten and removed this:

import { Dropdown, Modal, Tabs } from "tailwindcss-stimulus-components"
application.register('dropdown', Dropdown)
application.register('modal', Modal)
application.register('tabs', Tabs)

So that file looks like this now:

// Load all the controllers within this directory and all subdirectories. 
// Controller files must be named *_controller.js.
import { Application } from "stimulus" import { definitionsFromContext } from "stimulus/webpack-helpers"
const application = Application.start() const context = require.context("controllers", true, /_controller\.js$/) application.load(definitionsFromContext(context))
import { Dropdown, Modal, Tabs } from "tailwindcss-stimulus-components" application.register('dropdown', Dropdown) application.register('modal', Modal) application.register('tabs', Tabs)
Notifications
You’re not receiving notifications from this thread.