Fix redoing after append transaction #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "rahb/fix-append-redos"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a proposed solution to https://github.com/ProseMirror/prosemirror/issues/819, it also requires https://github.com/ProseMirror/prosemirror-state/pull/13 for it to work (although won't break if this patch isn't present i.e. a user is using a
prosemirror-statewithout prior to that hypothetical version)N.B. the new test here naturally won't pass without the change to
prosemirror-state.@ -266,2 +266,3 @@} else if ((appended || tr).getMeta("addToHistory") !== false) {} else if (tr.getMeta("addToHistory") !== false) {// Group transforms that occur in quick succession into one event.let historyRoot = rootTr && !!rootTr.getMeta(historyKey);I'd like to keep the behavior where transactions appended to a non-history root transaction aren't added to history either. What is the reason for this change?
I do see the problem here, but I'm not sure yet what the right solution is. I suspect this patch makes it possible for the history to become corrupted (you preserve the old
undonestack, but that is no longer aligned with the current document, since the transaction changed that). I'll think about it more when I'm back from my holiday.Yeah I realised this but thought I’d leave the straw man up as I think it
makes the problem a bit clearer than I put it in words. A plugin could do
anything to the state, I guess the lazy assumption by me here is that it
probably shouldn’t, but it actually isn’t a sound assumption. Enjoy your
holiday!
On Thu, 19 Jul 2018 at 20:20, Marijn Haverbeke notifications@github.com
wrote:
@ -266,2 +266,3 @@} else if ((appended || tr).getMeta("addToHistory") !== false) {} else if (tr.getMeta("addToHistory") !== false) {// Group transforms that occur in quick succession into one event.let historyRoot = rootTr && !!rootTr.getMeta(historyKey);As far as I can see this is the same thing. A transaction's
appendedTransactioncan only be itself (if at all). Soappendedis either falsey or=== tr, unless there's somewhere else thatappendedTransactionis being set that I've missed?@ -266,2 +266,3 @@} else if ((appended || tr).getMeta("addToHistory") !== false) {} else if (tr.getMeta("addToHistory") !== false) {// Group transforms that occur in quick succession into one event.let historyRoot = rootTr && !!rootTr.getMeta(historyKey);Right, but that's a bug (the behavior as you fixed it in the other PR was what I was trying to implement there)
Ah right - I did wonder! Either way it can wait 👍
On Fri, 20 Jul 2018 at 10:27, Marijn Haverbeke notifications@github.com
wrote:
Closing in favor of
2a94750Pull request closed