Preserving Custom attributes


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?

Keep preexisting custom attributes on nodes

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:

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.


That’s not working for me. :confused: The parse function highlighted is never called in my implementation. I’m using the]( demo. I’m totally new to ProseMirror.

I can’t get any attributes added to dinos in the content to stay preserved once the content is parsed and the dinos are converted into nodes.