hey all !, i run into a problem washing data on the server side.
in my scene, server encodeStateAsUpdate as snapshot after user click “publish” button, at the same time server should replace/wash some keyword according to the RPC result.
what borthers me is that:
The editor is based on Prosemirror, i can serialize the doc back to prosemirror’state or htmlstring then wash the content, but if i do like that, the doc is less of a collaborative state but more of a initial state, cus i cannot parse the washed state or htmlstring back to snapshot and show version diff, right ? the washed state or htmlstring can only be applied to init the doc and loss all updates once applied on that doc.
i my opinion, i should do something like “y.method()” on the server side to modify doc by update。but i don not have a clue how extract and modify on the server side…
any suggestion ?
I’m sorry, but I’m struggling to understand the problem.
If you want to show ProseMirror diffs you can’t discard the Yjs document (you need to store the Yjs document, not the ProseMirror document). You can show ProseMirror diffs using state vectors and the latest Yjs document. The Yjs document retains all history. The state vector points to a time in history. You can also use the state vector to compute document updates.
i my opinion, i should do something like “y.method()” on the server side to modify doc by update。but i don not have a clue how extract and modify on the server side…
“wash” means i need replace sensitive / dirty word text or improper video element on the server side, if the persistenct storeage is based on prosemirror without collaboration, i can handle the json or htmlstring directly, what if i embeded prosemirror with yjs ? should i transform data format between yxml and prosemirror or just add updates like “y.insert()” on the server side…