You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the sharedb client working with a codemirror instance, but I don’t see any tools or methods on the sharedb client to store and revert/reapply local changes. Current behavior in my app makes it so that pressing ctrl-z will undo ops sent from the server. Checking to see if anyone has implemented local undo or if I have to roll it myself? :)
The text was updated successfully, but these errors were encountered:
I have implemented it outside ShareDB based on the op and before op events only, however, I could probably port the solution to ShareDB core. I might look into doing it in a few weeks but I don't promise anything.
In case you want to roll out your own local undo/redo, here are some pointers:
if your ot type supports invert, you can use it to generate undo operations. Otherwise you could use diff - diff the snapshots from before op and op (this is what I do).
transform the undo/redo stacks top-down by the remote operations.
consider composing successive operations on the undo stack.
consider storing (and transforming) text selections on the undo/redo stack. (I'm planning to do that later but for now I set the caret at the furthest editing position on undo/redo.)
I got the sharedb client working with a codemirror instance, but I don’t see any tools or methods on the sharedb client to store and revert/reapply local changes. Current behavior in my app makes it so that pressing ctrl-z will undo ops sent from the server. Checking to see if anyone has implemented local undo or if I have to roll it myself? :)
The text was updated successfully, but these errors were encountered: