basecamp / basecamp/trix

Trix no longer adds dataset attributes on inserted attachments in 2.1.4

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

Description

Describe the bug or issue here…

##### Steps to Reproduce

1. Go to https://trix-editor.org/
2. Delete all of the content
3. Paste the following code into the console and run it
```js
(() => {
const trix = document.querySelector("trix-editor");
const attachment = new Trix.Attachment({
"attachment-type": "custom",
"content": "

Content
",
"contentType": "custom"
});

trix.editor.insertAttachment(attachment)
})()
```
4. Inspect the attachment within Trix and see that the div element is missing the data-item-id attribute

This was working fine prior to version 2.1.4.

##### Details

* Trix version: 2.1.4
* Browser name and version: Chrome 127.0.6533.89 (Official Build) (arm64)
* Operating system: MacOS

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the attachment insertion through Trix.Attachment and trix.editor.insertAttachment on the Trix demo using version 2.1.4. Compare the behavior with a pre-2.1.4 version and trace how the inserted attachment content is handled; the work is done when the div retains its data-item-id attribute.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.