2

When adding an attachment to my editor I want to add attributes. The core editor does something similar with Image attachments where you can add Captions.

How can I add the attributes? How Can I access them when rendering the attachment in the partial?

So I want to do something like this:

const attachment = new Trix.Attachment({content, sgid})
  attachment.setAttributes('link_text': 'some text', 'link_class': 'a-class')
  this.element.editor.insertAttachment(attachment)

And then in the partial gain access to those attrributes.

Will
  • 4,498
  • 2
  • 38
  • 65

0 Answers0