diff --git a/app/client/src/pages/Editor/GlobalHotKeys.test.tsx b/app/client/src/pages/Editor/GlobalHotKeys.test.tsx index 395ced42a6..4c317f5e10 100644 --- a/app/client/src/pages/Editor/GlobalHotKeys.test.tsx +++ b/app/client/src/pages/Editor/GlobalHotKeys.test.tsx @@ -575,6 +575,32 @@ describe("Undo/Redo hotkey", () => { ); }); + expect(dispatchSpy).toBeCalledTimes(1); + expect(dispatchSpy).toBeCalledWith(redoAction()); + }); + it("should dispatch redo Action on ctrl + y", () => { + const dispatchSpy = jest.spyOn(store, "dispatch"); + const component = render( + + + + + , + ); + + dispatchSpy.mockClear(); + + act(() => { + dispatchTestKeyboardEventWithCode( + component.container, + "keydown", + "Y", + 89, + false, + true, + ); + }); + expect(dispatchSpy).toBeCalledTimes(1); expect(dispatchSpy).toBeCalledWith(redoAction()); }); diff --git a/app/client/src/pages/Editor/GlobalHotKeys.tsx b/app/client/src/pages/Editor/GlobalHotKeys.tsx index f3dc3445f7..eb7cb9e075 100644 --- a/app/client/src/pages/Editor/GlobalHotKeys.tsx +++ b/app/client/src/pages/Editor/GlobalHotKeys.tsx @@ -306,6 +306,14 @@ class GlobalHotKeys extends React.Component { preventDefault stopPropagation /> + { case "undo": return <>UNDO ({modText()}+Z) ; case "redo": - return ( + return isMac() ? ( <> REDO ({modText()}++Z){" "} + ) : ( + <>REDO ({modText()}+Y) ); } };