2018-12-01 01:35:22 +01:00
|
|
|
class KeyboardShortcutParser {
|
|
|
|
|
static parseShortcut(keypress) {
|
|
|
|
|
var shortcutCombo = '';
|
|
|
|
|
|
|
|
|
|
if (keypress.ctrlKey) {
|
|
|
|
|
shortcutCombo += 'Ctrl + ';
|
|
|
|
|
}
|
|
|
|
|
if (keypress.shiftKey) {
|
|
|
|
|
shortcutCombo += 'Shift + ';
|
|
|
|
|
}
|
|
|
|
|
if (keypress.metaKey) {
|
|
|
|
|
shortcutCombo += 'Meta + ';
|
|
|
|
|
}
|
|
|
|
|
if (keypress.altKey) {
|
|
|
|
|
shortcutCombo += 'Alt + ';
|
|
|
|
|
}
|
2018-12-30 23:16:09 +01:00
|
|
|
if (keypress.key) {
|
|
|
|
|
shortcutCombo += keypress.key.toUpperCase();
|
|
|
|
|
} else {
|
|
|
|
|
shortcutCombo += '<mouse action>'
|
|
|
|
|
}
|
2018-12-01 01:35:22 +01:00
|
|
|
return shortcutCombo;
|
|
|
|
|
}
|
2018-12-30 23:16:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default KeyboardShortcutParser;
|