slate-deep-table icon indicating copy to clipboard operation
slate-deep-table copied to clipboard

Undo/Redo on removeNodeByKey

Open dannykok opened this issue 5 years ago • 3 comments

History is not recovered when trying to undo a row/column deletion, or redo a row/column insertion. case 1:

  1. delete a row/column
  2. press ctrl/cmd-z
  3. no response

case 2:

  1. insert a new row/column
  2. press ctrl/cmd-z, the insertion will be undone
  3. 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.

dannykok avatar Jul 15 '19 15:07 dannykok

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.

jasonphillips avatar Jul 17 '19 16:07 jasonphillips

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.

jasonphillips avatar Jul 17 '19 16:07 jasonphillips

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.

jasonphillips avatar Jul 17 '19 17:07 jasonphillips