(e: KeyboardEvent)
| 562 | |
| 563 | useEffect(() => { |
| 564 | const handleKeyDown = (e: KeyboardEvent) => { |
| 565 | if (props.collapsed) return; |
| 566 | if (!props.selectedWorkspace) return; |
| 567 | if (isEditableElement(e.target)) return; |
| 568 | const wsId = props.selectedWorkspace.workspaceId; |
| 569 | |
| 570 | if (matchesKeybind(e, KEYBINDS.EDIT_WORKSPACE_TITLE)) { |
| 571 | e.preventDefault(); |
| 572 | const meta = props.sortedWorkspacesByProject |
| 573 | .get(props.selectedWorkspace.projectPath) |
| 574 | ?.find((m) => m.id === wsId); |
| 575 | const displayTitle = meta?.title ?? meta?.name ?? ""; |
| 576 | requestEdit(wsId, displayTitle); |
| 577 | } else if (matchesKeybind(e, KEYBINDS.GENERATE_WORKSPACE_TITLE)) { |
| 578 | e.preventDefault(); |
| 579 | regenerateTitleForWorkspace(wsId); |
| 580 | } |
| 581 | }; |
| 582 | window.addEventListener("keydown", handleKeyDown); |
| 583 | return () => window.removeEventListener("keydown", handleKeyDown); |
| 584 | }, [ |
nothing calls this directly
no test coverage detected