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

Function convertShortcutToAccelerator

runtime/src/js/menu.js:18–31  ·  view source on GitHub ↗
({ control, meta, shift, alt, key } = {})

Source from the content-addressed store, hash-verified

16
17// Use to convert shortcut to accelerator for electron.
18function convertShortcutToAccelerator({ control, meta, shift, alt, key } = {}) {
19 // Store active modifier keys into an array.
20 const mods = [
21 control && 'Ctrl',
22 meta && 'Cmd',
23 shift && 'Shift',
24 alt && 'Alt',
25 ].filter(Boolean); // Remove any falsy values
26 // Get the actual key character and convert to uppercase.
27 const k = key?.char?.toUpperCase();
28 if (!k) return;
29 // Combine modifiers and key into a single string.
30 return [...mods, k].join('+');
31}
32
33// Binds click events to all menu and submenu items recursively.
34function bindMenuClicks(pgadminMenus, pgAdminMainScreen) {

Callers 1

bindMenuClicksFunction · 0.85

Calls 2

filterMethod · 0.80
joinMethod · 0.80

Tested by

no test coverage detected