(obj, useCode=false)
| 20 | import { getCode } from '@fluentui/keyboard-key'; |
| 21 | |
| 22 | export function parseShortcutValue(obj, useCode=false) { |
| 23 | let shortcut = ''; |
| 24 | if (!obj){ |
| 25 | return null; |
| 26 | } |
| 27 | if (obj.alt) { shortcut += 'alt+'; } |
| 28 | if (obj.shift) { shortcut += 'shift+'; } |
| 29 | if (isMac() && obj.ctrl_is_meta) { shortcut += 'meta+'; } |
| 30 | else if (obj.control) { shortcut += 'ctrl+'; } |
| 31 | shortcut += useCode ? obj?.key.key_code : obj?.key.char?.toLowerCase(); |
| 32 | return shortcut; |
| 33 | } |
| 34 | |
| 35 | export function parseKeyEventValue(e, useCode=false) { |
| 36 | let shortcut = ''; |
no test coverage detected