basecamp / basecamp/trix

Add and Retrieve Attributes to an Attachment

Open
#952 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
20k
Forks
1.1k
Avg merge
3d 12h
Merged PRs (30d)
13

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.