(e)
| 269 | document.addEventListener('keyup', keyEvent); |
| 270 | |
| 271 | function keyEvent(e) { |
| 272 | |
| 273 | e = e || event; |
| 274 | const key = e.which || e.keyCode; |
| 275 | keyMap[key] = e.type === 'keydown'; |
| 276 | |
| 277 | for (let i = 0; i < shortcutOptions.length; i++) { |
| 278 | const option = shortcutOptions[i]; |
| 279 | if (checkShortcut(option)) { |
| 280 | if ( |
| 281 | e.target instanceof Node && |
| 282 | (/textarea|input|select/i.test(e.target.nodeName) || (e.target instanceof Element && (e.target.shadowRoot || e.target.isContentEditable))) |
| 283 | ) { |
| 284 | con.info('Input field. Shortcut suppressed.'); |
| 285 | } else { |
| 286 | shortcutDetected(option); |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | function shortcutDetected(option) { |
| 292 | keyMap = {}; |
| 293 | callback({ shortcut: option }); |
| 294 | return false; |
| 295 | } |
| 296 | }; |
| 297 | |
| 298 | window.addEventListener( |
| 299 | 'focus', |
nothing calls this directly
no test coverage detected