Closed thatsjonsense closed 2 years ago
A flag like this would be nice.
I'm currently a bit overloaded with work, so here is my proposal: You create a PR with really nice documentation on how this feature works. Explain it for normal ProseMirror-users. Maybe create a Undo/Redo section in the README. I'll make some adjustments and implement the API that you suggested.
Hi Kevin that's very fair. I've added a proposed PR for this here: https://github.com/yjs/y-prosemirror/pull/111 , happy to explain more or make any changes if helpful
Implemented in y-prosemirror@1.1.0
.
Is your feature request related to a problem? Please describe. We have some ProseMirror commands that modify the doc programmatically, and we don't want users to be able to undo these. Specifically, when users upload an image, we first put a tempUrl into the state, and then put an uploadedUrl once the upload is incomplete. Right now, a user can hit undo and they'll go back to the tempUrl, which should never be a state you can get stuck in.
Describe the solution you'd like prosemirror-history has an
addToHistory
meta key you can make on a transaction that prevents undo on a specific transaction. I wish y-prosemirror would also honor the same meta key.Describe alternatives you've considered The only alternative I can think of is to register listeners on the undo manager, detect when undos happen that change this state, and then reapply them. This feels quite hacky.
Additional context Add any other context or screenshots about the feature request here.