yjs / y-prosemirror

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

Fix snapshots being ignored when passed on ysync plugin init #68

Closed geekuillaume closed 7 months ago

geekuillaume commented 2 years ago

When assigning snapshots to a fresh editor state with the ysync plugin (and before attaching to an EditorView), the snapshots are ignored because pluginState.binding is null. When pluginState.binding is set, change doesn't include the snapshot anymore and is ignored. This PR fixes this bug by reading the snapshot info from pluginState.snapshot and pluginState.prevSnapshot. This shouldn't break any workflow as these values are deleted when used anyway.