y-prosemirror icon indicating copy to clipboard operation
y-prosemirror copied to clipboard

Allow skipping YDoc updates for transactions

Open elad-barack opened this issue 2 years ago • 3 comments

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.

  • Some of them states that the user is in a middle of an "inner" session, and usually there's a floating card displayed when they are on the screen.
  • The other are kind of a "dictionary" marks. We don't want the other session to receive the same mark, even if it sound like we should on the first glance, since other parts of our editor screen won't be synced with it, which is problematic for our users.

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 avatar Apr 10 '23 15:04 elad-barack

@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..

elad-barack avatar Jul 03 '24 08:07 elad-barack

Would be great to have it!

sradu avatar Jul 08 '24 17:07 sradu

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?

dmonad avatar Jul 09 '24 14:07 dmonad