-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ignore transactions which were not added to history #4
base: master
Are you sure you want to change the base?
Conversation
`prosemirror-history` reads a metadata field `addToHistory` and doesn't record changes if a transactions sets it to `false`. I think its reasonable that this plugin ignores these transactions as well as they are not undoable by the undo command anyways.
Why? |
If your questions targets the reasoning why the plugin should ignore transactions with
|
Btw since this is probably a breaking change I could also add a configuration option to
|
Ah, right, you're trying to avoid clearing the undo logic when something like a collaborative change comes in. But as it is, this patch isn't correct—if, for example, a non-history change inserts or deletes content before the last inputrules change, the positions in that stored change no longer align with the current document. |
Thanks for the response! Makes total sense. I am fairly new to Prosemirror and am trying to figure out how to solve the problem you mentioned. As soon as there is a change that affects not only the position of an original input rule change, but also maybe it's contents and that change is not added to history I think we could not recover. As such I'd think of two options:
|
Look into position mapping—it is probably possible to update the undoable data in a safe way. |
This is what I thought about, however we would still need to discard the transactions as soon as another transaction comes along which modifies inside of the (mapped) range of the original transaction, no? So in pseudo-code something like this?
|
This is the same case as step rebasing for history or collab editing. You can map steps through anything. Sometimes the result will be null (the changed content was deleted) and sometimes the step can't be applied anymore ( |
Thanks for the response, really appreciate it. I will see if I can make sense out of it and build it into my patch. |
prosemirror-history
reads a metadata fieldaddToHistory
and doesn'tallow to undo changes if a transactions sets it to
false
. I think itsreasonable that this plugin ignores these transactions as well as they
are not undoable by the undo command anyways.