#1178·trix

Trix no longer adds dataset attributes on inserted attachments in 2.1.4

Author: J-MichalekCreated Aug 7, 2024Updated Sep 23, 2025

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
javascript
(() => {
    const trix = document.querySelector("trix-editor");
    const attachment = new Trix.Attachment({
    "attachment-type": "custom",
    "content": "<div data-item-id='123'>Content</div>",
    "contentType": "custom"
    });

    trix.editor.insertAttachment(attachment)
})()
  1. 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