From 3bd5f9542e78a7dc9f8fcc39b31e30e3347abc56 Mon Sep 17 00:00:00 2001 From: Yi Date: Thu, 22 Aug 2024 17:51:12 +0800 Subject: [PATCH] add "add block" shortcut ui --- web/app/components/workflow/hooks/use-shortcuts.ts | 5 +++++ web/app/components/workflow/panel-contextmenu.tsx | 1 + web/app/components/workflow/utils.ts | 1 + 3 files changed, 7 insertions(+) diff --git a/web/app/components/workflow/hooks/use-shortcuts.ts b/web/app/components/workflow/hooks/use-shortcuts.ts index 9484f9c16e..9136573a50 100644 --- a/web/app/components/workflow/hooks/use-shortcuts.ts +++ b/web/app/components/workflow/hooks/use-shortcuts.ts @@ -77,6 +77,11 @@ export const useShortcuts = (): void => { } }, { exactMatch: true, useCapture: true }) + useKeyPress(`${getKeyboardKeyCodeBySystem('shift')}.a`, (e) => { + if (shouldHandleShortcut(e)) + e.preventDefault() + }, { exactMatch: true, useCapture: true }) + useKeyPress(`${getKeyboardKeyCodeBySystem('alt')}.r`, (e) => { if (shouldHandleShortcut(e)) { e.preventDefault() diff --git a/web/app/components/workflow/panel-contextmenu.tsx b/web/app/components/workflow/panel-contextmenu.tsx index 502967ce2c..33440e1353 100644 --- a/web/app/components/workflow/panel-contextmenu.tsx +++ b/web/app/components/workflow/panel-contextmenu.tsx @@ -38,6 +38,7 @@ const PanelContextmenu = () => { className='flex items-center justify-between px-3 h-8 text-sm text-gray-700 rounded-lg cursor-pointer hover:bg-gray-50' > {t('workflow.common.addBlock')} + ) } diff --git a/web/app/components/workflow/utils.ts b/web/app/components/workflow/utils.ts index 0d07b2e568..33b53b2770 100644 --- a/web/app/components/workflow/utils.ts +++ b/web/app/components/workflow/utils.ts @@ -427,6 +427,7 @@ export const isMac = () => { const specialKeysNameMap: Record = { ctrl: '⌘', alt: '⌥', + shift: '⇧', } export const getKeyboardKeyNameBySystem = (key: string) => {