basecamp/trix

Add and Retrieve Attributes to an Attachment

asecondwill opened this issue · 0 comments

I'm adding an attachment like this:

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

However line 2 does not do anything. How can I set attributes for my attachment and then retrive and use them in the attachment template when the rich text is rendered? Is this possible? It seems like something similar is happening with caption text for example.