Работа над хоткеями

This commit is contained in:
Book Pauk
2020-03-15 16:12:55 +07:00
parent 4b146c70ad
commit 8f6201b0f7
2 changed files with 88 additions and 3 deletions

View File

@@ -202,4 +202,20 @@ export function escapeXml(str) {
.replace(/"/g, '"')
.replace(/'/g, ''')
;
}
export function keyEventToCode(event) {
let result = [];
if (event.metaKey)
result.push('Meta');
if (event.ctrlKey)
result.push('Ctrl');
if (event.shiftKey)
result.push('Shift');
if (event.altKey)
result.push('Alt');
result.push(event.code);
return result.join('+');
}