yjs / y-prosemirror

ProseMirror editor binding for Yjs
https://demos.yjs.dev/prosemirror/prosemirror.html
MIT License
328 stars 115 forks source link

Allow skipping YDoc updates for transactions #134

Open elad-barack opened 1 year ago

elad-barack commented 1 year ago

YJS integration with our editor encountered a problem. We have some PM nodes & marks that are per-session. We do not want to update other sessions about their existence and changes when they are in the doc.

We just used addToHistory flag until we added YJS. It worked great :) The change is basically a very small one. We added a state param called addToYDoc that is true by default, and false only when a user passes addToYDoc in the transaction meta. When it's false, the change won't be reflected in the doc history, so we won't update other sessions about the redundant change.

elad-barack commented 1 month ago

@dmonad Is there any chance someone will take a look and merge? Many people reacted to the PR, so it might help others as well..

sradu commented 1 month ago

Would be great to have it!

dmonad commented 1 month ago

Maybe I don't understand this feature, but wouldn't the changes be merged into Yjs the next time a change is emitted? Have you been able to test that this works?

In any case, I feel there is a better solution to this problem.

It would be nice to see Yjs in nextcloud. Could you explain in more detail what you are trying to achieve?