morethanwords
3 years ago
18 changed files with 34 additions and 84 deletions
@ -1,21 +0,0 @@ |
|||||||
/* |
|
||||||
* https://github.com/morethanwords/tweb
|
|
||||||
* Copyright (C) 2019-2021 Eduard Kuzmenko |
|
||||||
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
|
||||||
*/ |
|
||||||
|
|
||||||
export default function getKeyFromEvent(e: KeyboardEvent) { |
|
||||||
let key = e.key; |
|
||||||
if(!key) { |
|
||||||
key = e.code; |
|
||||||
if(key.startsWith('Key')) { |
|
||||||
key = e.code.slice(3); |
|
||||||
|
|
||||||
if(!e.shiftKey && key.length < 2) { |
|
||||||
key = key.toLowerCase(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return key; |
|
||||||
} |
|
@ -1,12 +0,0 @@ |
|||||||
/* |
|
||||||
* https://github.com/morethanwords/tweb
|
|
||||||
* Copyright (C) 2019-2021 Eduard Kuzmenko |
|
||||||
* https://github.com/morethanwords/tweb/blob/master/LICENSE
|
|
||||||
*/ |
|
||||||
|
|
||||||
import getKeyFromEvent from "./getKeyFromEvent"; |
|
||||||
import { capitalizeFirstLetter } from "../string"; |
|
||||||
|
|
||||||
export default function getKeyFromEventCaseInsensitive(e: KeyboardEvent) { |
|
||||||
return capitalizeFirstLetter(getKeyFromEvent(e)); |
|
||||||
} |
|
Loading…
Reference in new issue