From d07dec91951a4d272f2fc0cc58bd110a8c9d4dc6 Mon Sep 17 00:00:00 2001 From: igorrCarvalho Date: Sun, 9 Jun 2024 19:06:05 -0300 Subject: [PATCH] Add preventDefault to every shortcut call --- .../components/nodeToolbarComponent/index.tsx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx index e534ce69d..3bb03e8a1 100644 --- a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx @@ -47,6 +47,7 @@ export default function NodeToolbarComponent({ setShowState, onCloseAdvancedModal, }: nodeToolbarPropsType): JSX.Element { + const preventDefault = true; const isMac = navigator.platform.toUpperCase().includes("MAC"); const nodeLength = Object.keys(data.node!.template).filter( (templateField) => @@ -170,16 +171,16 @@ export default function NodeToolbarComponent({ const download = useShortcutsStore((state) => state.download); const freeze = useShortcutsStore((state) => state.freeze); - useHotkeys(minimize, handleMinimizeWShortcut); - useHotkeys(update, handleUpdateWShortcut); - useHotkeys(group, handleGroupWShortcut); - useHotkeys(share, handleShareWShortcut); - useHotkeys(code, handleCodeWShortcut); - useHotkeys(advanced, handleAdvancedWShortcut); - useHotkeys(save, handleSaveWShortcut); - useHotkeys(docs, handleDocsWShortcut); - useHotkeys(download, handleDownloadWShortcut); - useHotkeys(freeze, handleFreeze); + useHotkeys(minimize, handleMinimizeWShortcut, { preventDefault }); + useHotkeys(update, handleUpdateWShortcut, { preventDefault }); + useHotkeys(group, handleGroupWShortcut, { preventDefault }); + useHotkeys(share, handleShareWShortcut, { preventDefault }); + useHotkeys(code, handleCodeWShortcut, { preventDefault }); + useHotkeys(advanced, handleAdvancedWShortcut, { preventDefault }); + useHotkeys(save, handleSaveWShortcut, { preventDefault }); + useHotkeys(docs, handleDocsWShortcut, { preventDefault }); + useHotkeys(download, handleDownloadWShortcut, { preventDefault }); + useHotkeys(freeze, handleFreeze, { preventDefault }); const isMinimal = numberOfHandles <= 1; const isGroup = data.node?.flow ? true : false;