yjs / y-prosemirror

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

Allow passing a custom undoManager to undoPlugin #87

Closed nc closed 2 years ago

nc commented 2 years ago

So you can have one UndoManager for multiple ProseMirror instances

dmonad commented 2 years ago

Makes sense. We don't need this file though. But I'll remove it and make a new release.

ankon commented 2 years ago

Just leaving a short comment here for future readers: We also needed this change in our remirror-based collaborative editor, as we observed leaks of the Y.UndoManager instances whenever a new state for the editor was created. We move the initialization of the undo manager into the "plugin" to ensure that there is a 1:1 mapping between the Y.Doc instance and the Y.UndoManager.

I'm not sure whether prosemirror has protections against that (only one call to init ever?), or whether the same issue might exist there as well.