asecondwill said almost 3 years ago on Embedding Youtube Videos into Action Text with Stimulus :
For some attachments, It would be great to add attributes that don't change.  The text in a link for example or a class on an image attachment. 

Is that possible to do ?

Something like this:

  const attachment = new Trix.Attachment({content, sgid})
  attachment.setAttributes(link_text: link_text, link_class: 'a-class')

And then have access to the attributes in the rendering partial for that Model.