<p>I've created a custom ckeditor5 plugin.
The plugin adds a new button to ckeditor5 toolbar to add a custom HTML tag with some data.</p>
<p></p>
<p>Switching between view and model in ckeditor works fine.</p>
<p>But from the moment I save the field in Craft CMS CP, the custom HTML tag is removed.</p>
<p>I'm not sure where the tag is removed before 'save'.
I'm new to Craft, I was looking into the craft/config/htmlpurifier/Default.json</p>
<p>In that file you can make some changes (<a href="http://htmlpurifier.org/live/configdoc/plain.html" rel="nofollow noreferrer">http://htmlpurifier.org/live/configdoc/plain.html</a>), but I'm not sure if this is the right place to look into.</p>
<p>More from this docs:
If you attempt to allow an element that HTML Purifier does not know about, HTML Purifier will raise an error. You will need to manually tell HTML Purifier about this element by using the advanced customization features.</p>
<p>Is it really that complex to allow a custom tag to not being removed on save?
Maybe I'm looking in the wrong direction. If so please assist.</p>

CC BY-SA 4.0
2024-06-20T08:22:50.373Z
Describe what you mean by 'custom html element'…
Seth Warburton
CC BY-SA 4.0
2024-06-20T13:34:03.387Z
<my-element page-id="123"/> // model
<a href="converted-link.html">page-title</a> // view
 Hope this helps.
user3086053
<craft5><ckeditor5>
Custom HTML tag removed from ckEditor5 on save
# Custom HTML tag removed from ckEditor5 on save

(Asked by: username_0 on 2024-06-17)

I've created a custom ckeditor5 plugin.
The plugin adds a new button to ckeditor5 toolbar to add a custom HTML tag with some data.

Switching between view and model in ckeditor works fine.

But from the moment I save the field in Craft CMS CP, the custom HTML tag is removed.

I'm not sure where the tag is removed before 'save'.
I'm new to Craft, I was looking into the craft/config/htmlpurifier/Default.json

In that file you can make some changes (<http://htmlpurifier.org/live/configdoc/plain.html>), but I'm not sure if this is the right place to look into.

More from this docs:
If you attempt to allow an element that HTML Purifier does not know about, HTML Purifier will raise an error. You will need to manually tell HTML Purifier about this element by using the advanced customization features.

Is it really that complex to allow a custom tag to not being removed on save?
Maybe I'm looking in the wrong direction. If so please assist.

**Tags:** craft5, ckeditor5
> **Comments:**
> **username_1**: Describe what you mean by 'custom html element'…  
> **username_0**: <my-element page-id="123"/> // model <a href="converted-link.html">page-title</a> // view  Hope this helps.  

---

## 0 answers

