feat: open new checklist item form on enter

This commit is contained in:
Henry
2025-12-18 22:08:23 +00:00
parent 2694498335
commit bedf49387b
2 changed files with 6 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ interface ChecklistItemRowProps {
completed: boolean;
};
cardPublicId: string;
onCreateNewItem?: () => void;
viewOnly?: boolean;
dragHandleProps?: DraggableProvided["dragHandleProps"];
isDragging?: boolean;
@@ -25,6 +26,7 @@ interface ChecklistItemRowProps {
export default function ChecklistItemRow({
item,
cardPublicId,
onCreateNewItem,
viewOnly = false,
dragHandleProps,
isDragging = false,
@@ -202,6 +204,7 @@ export default function ChecklistItemRow({
e.preventDefault();
const innerHTML = (e.currentTarget as HTMLElement).innerHTML;
commitTitle(innerHTML);
onCreateNewItem?.();
}
if (e.key === "Escape") {
e.preventDefault();

View File

@@ -210,6 +210,9 @@ export default function Checklists({
completed: item.completed,
}}
cardPublicId={cardPublicId}
onCreateNewItem={() =>
setActiveChecklistForm?.(checklist.publicId)
}
viewOnly={viewOnly}
dragHandleProps={provided.dragHandleProps}
isDragging={snapshot.isDragging}