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

View File

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