Closed gabriel-peracio closed 5 months ago
@dmonad I also really need this PR. At this moment I use local package fork only for 1 line change :)
I merged this and published the changes in y-prosemirror@v1.2.3
. However, use it at your own peril! This function is designed to reflect change when performing real-time editing. It is not well suited for larger amounts of edits.
This function is designed to reflect change when performing real-time editing. It is not well suited for larger amounts of edits.
What kind of problems one might expect to see? Does this potentially cause data corruption or just performance issues?
What this does
updateYFragment
Why?
updateYFragment
outside of the context of the pluginBut why?
My usecase is to allow a server to apply prosemirror transactions to a yDoc by using prosemirror transactions, instead of yJS transactions. I do this by:
yDoc
from the serverpmDoc
from theyDoc
using the existing utilitiestr.doThing()
)dispatch(tr)
, because I never mount the prosemirror view, therefore I just get the resulting document with the modifications applied by reading fromtr.doc
updateYFragment
This results in code like this (I'm using tiptap/hocuspocus):