slate-deep-table
slate-deep-table copied to clipboard
Undo/Redo on removeNodeByKey
History is not recovered when trying to undo a row/column deletion, or redo a row/column insertion. case 1:
- delete a row/column
- press ctrl/cmd-z
- no response
case 2:
- insert a new row/column
- press ctrl/cmd-z, the insertion will be undone
- then press ctrl/cmd-shift-z, redo will fail with no response
I've tested on the given schema, but seems the problem doesn't relate to normalisation. I can't verify if this is possibly a bug on slate regarding history management. Since both the above operations are dealing with removeNodeByKey.
I am using Slate 0.47.4 slate-deep-table 0.9.6.
Interesting... there are existing tests for undoing column / row addition and deletion (eg: https://github.com/jasonphillips/slate-deep-table/tree/master/tests/undo-remove-column), so I'm initially confused as to how those are passing yet the behavior may be broken. Those tests need further examination, it seems.
On further examination, this appears to be related to the recent Slate issue with undo / redo and editor focus:
https://github.com/ianstormtaylor/slate/issues/2891
I verified by building my example with Undo / Redo buttons instead of just shortcut keys, and was able to see it working normally, so long as I didn't click within / outside of the editor again between events.
And this second Slate bug:
https://github.com/ianstormtaylor/slate/issues/2729
So there are multiple unresolved issues with editor focus and history undo / redo in Slate core now.