trix icon indicating copy to clipboard operation
trix copied to clipboard

Add and Retrieve Attributes to an Attachment

Open asecondwill opened this issue 4 years ago • 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.

asecondwill avatar Jan 28 '22 22:01 asecondwill