MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / shortcutToString

Function shortcutToString

web/pgadmin/static/js/components/ShortcutTitle.jsx:55–74  ·  view source on GitHub ↗
(shortcut, accesskey=null, asArray=false)

Source from the content-addressed store, hash-verified

53}
54
55export function shortcutToString(shortcut, accesskey=null, asArray=false) {
56 let keys = [];
57 if(accesskey) {
58 keys = getBrowserAccesskey();
59 keys.push(_.capitalize(accesskey?.toUpperCase()));
60 } else if(shortcut) {
61 if(shortcut.alt) keys.push(isMac() ? '⌥' : 'Alt');
62 if(isMac() && shortcut.ctrl_is_meta) {
63 if(shortcut.control) keys.push('⌘');
64 } else {
65 if(shortcut.control) keys.push(isMac() ? '⌃' : 'Ctrl');
66 }
67 if(shortcut.shift) keys.push(isMac() ? '⇧' : 'Shift');
68 keys.push(_.capitalize(shortcut.key.char));
69 } else {
70 return '';
71 }
72
73 return asArray || isMac() ? keys : keys.join(' + ');
74}
75
76/* The tooltip content to show shortcut details */
77export default function ShortcutTitle({title, shortcut, accesskey}) {

Callers 3

Menu.jsxFile · 0.90
ShortcutTitleFunction · 0.85

Calls 3

isMacFunction · 0.90
getBrowserAccesskeyFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected