Is there a way to get the editor to not drop custom attributes on elements. I use data-id’s to map back to another document. The problem I have is I have not found in the documentation a way to make the editor not drop (or be aware) of these attributes when it does the transformation.
Is there a way to inform the transformations to keep the attributes?
1 Like
AFAIK you’ll have to make custom schema for all block types that need to maintain that. Here’s our div
schema that does that: https://github.com/the-grid/ed/blob/d12b957586891d9affeb710314e5b651c047ca7a/src/schema/media.js#L24-L34
If you’re doing this with normal editable HTML types you’ll have to consider duplicate ids when you split a paragraph into two, or copy and paste.
(We ended up only tracking ids on non-html block types, though this might change.)
I had a feeling it had to be done that way and started to look at schemas. I already handle duplicate ids with my custom editor that I wrote that I am trying to replace so not a big issue there.