Custom tags and attributes not being added
- Dominant language
- JavaScript
- Stars
- 20k
- Forks
- 1.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 13
Description
Hello,
Thanks for your hard work. I'm having issues adding custom tags or custom attributes to the editor. I'm loading the Trix editor with initial value `Hello Trix!` (via an attached `` tag) but the Trix editor's input displays `
Here is a minimal project that reproduces the issue:
```HTML
document.addEventListener("trix-before-initialize", function() {
console.log("Trix is about to initialize!");
// According to the README.md, this should add support for custom tags and attributes
Trix.config.dompurify.ADD_TAGS = [ 'my-custom-tag' ]
Trix.config.dompurify.ADD_ATTR = [ 'id' ];
});
Welcome to My Website
This is a simple HTML page.
```
Note that the editor's input displays `
Am I setting up the project incorrectly? I skimmed through the code and it seemed to me that the config that we pass to `Trix.config.dompurify` is not being used when parsing HTML.
Thank you for reviewing this ticket.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the minimal HTML reproduction and the trix-before-initialize handler, then trace how Trix.config.dompurify is applied while the input value is parsed. Verify whether the configured custom tag and id attribute survive initialization; done means the editor preserves the supplied custom HTML rather than displaying a div-only version.
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
- 42/100