Skip to content

Commit

Permalink
Automated linting update and features.json sync
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 19, 2023
1 parent 7804a6d commit c5baa65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions packages/studio-ui/src/components/UndoRedo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,18 @@ export default function UndoRedo(): JSX.Element {
redo();
}, [redo]);

const handleUndoKeydown = useCallback((event: KeyboardEvent) => {
event.preventDefault()
if ((event.ctrlKey || event.metaKey) && event.key === "z") {
undo()
}
}, [undo])
const handleUndoKeydown = useCallback(
(event: KeyboardEvent) => {
event.preventDefault();
if ((event.ctrlKey || event.metaKey) && event.key === "z") {
undo();
}
},
[undo]
);

useEffect(() => {
document.addEventListener("keydown", handleUndoKeydown)
document.addEventListener("keydown", handleUndoKeydown);
}, [handleUndoKeydown]);

const disableUndo = pastStates.length === 0;
Expand Down
4 changes: 2 additions & 2 deletions packages/studio-ui/tests/components/UndoRedo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe("Undo/redo", () => {
expect(useStudioStore.getState().pages.activeComponentUUID).toBe(
"searchbar-uuid"
);
await userEvent.keyboard('{Control>}z{/Control}')
await userEvent.keyboard("{Control>}z{/Control}");
expect(useStudioStore.getState().pages.activeComponentUUID).toBeUndefined();
});

Expand All @@ -60,7 +60,7 @@ describe("Undo/redo", () => {
expect(useStudioStore.getState().pages.activeComponentUUID).toBe(
"searchbar-uuid"
);
await userEvent.keyboard('{Meta>}z{/Meta}')
await userEvent.keyboard("{Meta>}z{/Meta}");
expect(useStudioStore.getState().pages.activeComponentUUID).toBeUndefined();
});

Expand Down

0 comments on commit c5baa65

Please sign in to comment.