Snapshotting ProseMirror nodes with attributes


so as I’m messing around with the snapshotting feature I noticed my node attributes are not persisted in the snapshot.

Use the @ symbol in the toolbar to toggle a “makeMeRed” attribute to either a paragraph or blockquote. I wonder what I’m doing wrong here. The code is basically the same as in the prosemirror-versions demo.

As I debugged this a little further, it seems that this line retrieves the attributes but in my case nothing is returned. Ah, well to be exact when I’m using an object as an attribute it marks it as deleted and the YXmlElement getAttributes doesn’t return it (curiously it takes snapshot as a parameter but doesn’t use it).

I’ve added console.logs to yjs/y-prosemirror in the demo which shows ‘makeMeRed’ is retrieved but always the current value of the said node. I recall Kevin saying that snapshots are not finished so perhaps this is one of those parts? Having written all this, I’m pretty sure it’s about that snapshot parameter not being used to retrieve the current value of the node attribute?

(Also as a sidenote, it seems the renderSnapshot plays a bit weird with the paragraphs inside a blockquote)