Closed KennethSundqvist closed 9 years ago
We did some work around fixing this. One of our internal solutions that we didn't pursue in the end was to use Virtual Dom record undos one at a time. Obviously a complex scenario like this is hard to reproduce - perhaps you could write a failing test case?
It's difficult to debug without knowing the exact steps to reproduce. Could you write a failing test?
One of our suggested solutions internally was to use Virtual DOM and record each keypress. We decided not to pursue it as the current fix was enough for us. You could try looking at https://github.com/guardian/scribe-plugin-advanced-undo to see if would work for you.
So I found why this happened, and it was a configuration error on my part.
We use a keyboard shortcuts configuration object that we use to generate the checker functions for the shortcuts plugin as well as labels that we show to the users, so they're all consistent. To get the label for the undo button we included it in that configuration, but that meant that a shortcut checker was also created and added to the shortcuts plugin, and since Scribe adds a shortcut for undo by default which use the same key combo that we use, the undo command would be triggered twice.
Test this by performing a fairly complex sequence of events, like typing some text, use backspace, wait a little, type some more, apply bold to one word and italic to another.
Use undo several times then redo the same amount of times.
They will not go through the same steps, and the content can be different when you're done redoing than before you started undoing.