From 723a31051e121b84f7b83bd6382097695d03cf4e Mon Sep 17 00:00:00 2001 From: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:03:46 -0300 Subject: [PATCH] feat: add ctrl+shift+z alternative shortcut for redoing actions (#5536) * Added alternative for redo * Added redo alternative on hotkeys * added redo alternative type --------- Co-authored-by: anovazzi1 --- src/frontend/src/constants/constants.ts | 5 +++++ .../src/pages/FlowPage/components/PageComponent/index.tsx | 3 +++ src/frontend/src/stores/shortcuts.ts | 1 + src/frontend/src/types/store/index.ts | 1 + 4 files changed, 10 insertions(+) diff --git a/src/frontend/src/constants/constants.ts b/src/frontend/src/constants/constants.ts index a33136f22..545b61f8b 100644 --- a/src/frontend/src/constants/constants.ts +++ b/src/frontend/src/constants/constants.ts @@ -831,6 +831,11 @@ export const defaultShortcuts = [ name: "Redo", shortcut: "mod+y", }, + { + display_name: "Redo (alternative)", + name: "Redo Alt", + shortcut: "mod+shift+z", + }, { display_name: "Group", name: "Group", diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index 2cdc050a1..5c618bd41 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -290,6 +290,7 @@ export default function Page({ view }: { view?: boolean }): JSX.Element { const undoAction = useShortcutsStore((state) => state.undo); const redoAction = useShortcutsStore((state) => state.redo); + const redoAltAction = useShortcutsStore((state) => state.redoAlt); const copyAction = useShortcutsStore((state) => state.copy); const duplicate = useShortcutsStore((state) => state.duplicate); const deleteAction = useShortcutsStore((state) => state.delete); @@ -301,6 +302,8 @@ export default function Page({ view }: { view?: boolean }): JSX.Element { //@ts-ignore useHotkeys(redoAction, handleRedo); //@ts-ignore + useHotkeys(redoAltAction, handleRedo); + //@ts-ignore useHotkeys(groupAction, handleGroup); //@ts-ignore useHotkeys(duplicate, handleDuplicate); diff --git a/src/frontend/src/stores/shortcuts.ts b/src/frontend/src/stores/shortcuts.ts index afd7927cf..038172fe6 100644 --- a/src/frontend/src/stores/shortcuts.ts +++ b/src/frontend/src/stores/shortcuts.ts @@ -13,6 +13,7 @@ export const useShortcutsStore = create((set, get) => ({ flow: "mod+shift+b", undo: "mod+z", redo: "mod+y", + redoAlt: "mod+shift+z", openPlayground: "mod+k", advancedSettings: "mod+shift+a", minimize: "mod+.", diff --git a/src/frontend/src/types/store/index.ts b/src/frontend/src/types/store/index.ts index 31da0121c..a48dbf387 100644 --- a/src/frontend/src/types/store/index.ts +++ b/src/frontend/src/types/store/index.ts @@ -31,6 +31,7 @@ export type shortcutsStoreType = { openPlayground: string; undo: string; redo: string; + redoAlt: string; advancedSettings: string; minimize: string; code: string;