MCPcopy
hub / github.com/coder/mux / handleKeyDown

Function handleKeyDown

src/browser/components/ProjectSidebar/ProjectSidebar.tsx:564–581  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

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 }, [

Callers

nothing calls this directly

Calls 5

isEditableElementFunction · 0.90
matchesKeybindFunction · 0.90
getSubProjectsForParentFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected