| 2458 | }, |
| 2459 | |
| 2460 | async sendKey(event) { |
| 2461 | if (this.annotating) return; |
| 2462 | const contextId = this.normalizeContextId(this.activeBrowserContextId || this.contextId); |
| 2463 | if (!contextId || !this.activeBrowserId) return; |
| 2464 | if (event.ctrlKey || event.metaKey || event.altKey) return; |
| 2465 | const editable = ["INPUT", "TEXTAREA", "SELECT"].includes(event.target?.tagName); |
| 2466 | if (editable) return; |
| 2467 | event.preventDefault(); |
| 2468 | const printable = event.key && event.key.length === 1; |
| 2469 | await websocket.emit("browser_viewer_input", { |
| 2470 | context_id: contextId, |
| 2471 | browser_id: this.activeBrowserId, |
| 2472 | input_type: "keyboard", |
| 2473 | key: printable ? "" : event.key, |
| 2474 | text: printable ? event.key : "", |
| 2475 | }); |
| 2476 | }, |
| 2477 | |
| 2478 | async sendShortcut(key) { |
| 2479 | const contextId = this.normalizeContextId(this.activeBrowserContextId || this.contextId); |