diff --git a/src/frontend/src/components/headerComponent/components/menuBar/index.tsx b/src/frontend/src/components/headerComponent/components/menuBar/index.tsx index 35542ca2a..6babcf5fd 100644 --- a/src/frontend/src/components/headerComponent/components/menuBar/index.tsx +++ b/src/frontend/src/components/headerComponent/components/menuBar/index.tsx @@ -20,8 +20,10 @@ import { cn } from "../../../../utils/utils"; import IconComponent from "../../../genericIconComponent"; import ShadTooltip from "../../../shadTooltipComponent"; import { Button } from "../../../ui/button"; +import { useShortcutsStore } from "../../../../stores/shortcuts"; export const MenuBar = ({}: {}): JSX.Element => { + const shortcuts = useShortcutsStore((state) => state.shortcuts); const addFlow = useFlowsManagerStore((state) => state.addFlow); const currentFlow = useFlowsManagerStore((state) => state.currentFlow); const setErrorData = useAlertStore((state) => state.setErrorData); @@ -144,10 +146,12 @@ export const MenuBar = ({}: {}): JSX.Element => { /> ) : ( - Ctrl +{" "} + { + shortcuts.find((s) => s.name.toLowerCase() === "undo") + ?.shortcut + } )} - Z { @@ -164,10 +168,12 @@ export const MenuBar = ({}: {}): JSX.Element => { /> ) : ( - Ctrl +{" "} + { + shortcuts.find((s) => s.name.toLowerCase() === "redo") + ?.shortcut + } )} - Y diff --git a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/toolbarSelectItem/index.tsx b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/toolbarSelectItem/index.tsx index 1037824ae..1db08834f 100644 --- a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/toolbarSelectItem/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/toolbarSelectItem/index.tsx @@ -27,11 +27,13 @@ export default function ToolbarSelectItem({
- {value} + + {value} + {hasShift ? ( <> diff --git a/src/frontend/src/stores/shortcuts.ts b/src/frontend/src/stores/shortcuts.ts index 8b60fc50b..87dc21453 100644 --- a/src/frontend/src/stores/shortcuts.ts +++ b/src/frontend/src/stores/shortcuts.ts @@ -39,6 +39,13 @@ export const useShortcutsStore = create((set, get) => ({ if (localStorage.getItem("langflow-shortcuts")) { const savedShortcuts = localStorage.getItem("langflow-shortcuts"); const savedUShortcuts = localStorage.getItem("langflow-UShortcuts"); + const savedArr = JSON.parse(savedShortcuts!); + savedArr.forEach(({ name, shortcut }) => { + let shortcutName = name.split(" ")[0].toLowerCase(); + set({ + [shortcutName]: shortcut, + }); + }); get().setShortcuts( JSON.parse(savedShortcuts!), JSON.parse(savedUShortcuts!),