add "add block" shortcut ui

This commit is contained in:
Yi 2024-08-22 17:51:12 +08:00
parent fef4e09dfc
commit 3bd5f9542e
3 changed files with 7 additions and 0 deletions

View File

@ -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()

View File

@ -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')}
<ShortcutsName keys={['shift', 'a']} />
</div>
)
}

View File

@ -427,6 +427,7 @@ export const isMac = () => {
const specialKeysNameMap: Record<string, string | undefined> = {
ctrl: '⌘',
alt: '⌥',
shift: '⇧',
}
export const getKeyboardKeyNameBySystem = (key: string) => {