BackgroundInputComponent

This commit is contained in:
Shin'ya Ueoka 2017-10-01 17:17:20 +09:00
parent 825bb63476
commit a74a8b537e
4 changed files with 60 additions and 51 deletions

21
src/shared/keys.js Normal file
View file

@ -0,0 +1,21 @@
const asKeymapChars = (keys) => {
return keys.map((k) => {
let c = String.fromCharCode(k.code);
if (k.ctrl) {
return '<C-' + c.toUpperCase() + '>';
}
return c;
}).join('');
};
const asCaretChars = (keys) => {
return keys.map((k) => {
let c = String.fromCharCode(k.code);
if (k.ctrl) {
return '^' + c.toUpperCase();
}
return c;
}).join('');
};
export { asKeymapChars, asCaretChars };