File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
apps/web/src/views/card/components Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ interface ChecklistItemRowProps {
1717 completed : boolean ;
1818 } ;
1919 cardPublicId : string ;
20+ onCreateNewItem ?: ( ) => void ;
2021 viewOnly ?: boolean ;
2122 dragHandleProps ?: DraggableProvided [ "dragHandleProps" ] ;
2223 isDragging ?: boolean ;
@@ -25,6 +26,7 @@ interface ChecklistItemRowProps {
2526export default function ChecklistItemRow ( {
2627 item,
2728 cardPublicId,
29+ onCreateNewItem,
2830 viewOnly = false ,
2931 dragHandleProps,
3032 isDragging = false ,
@@ -187,7 +189,10 @@ export default function ChecklistItemRow({
187189 disabled = { viewOnly }
188190 onChange = { ( e ) => setTitle ( e . target . value ) }
189191 // @ts -expect-error - valid event
190- onBlur = { ( e : Event ) => commitTitle ( e . target . innerHTML as string ) }
192+ onBlur = { ( e : Event ) => {
193+ const innerHTML = ( e . target as HTMLElement ) . innerHTML ;
194+ commitTitle ( innerHTML ) ;
195+ } }
191196 className = { twMerge (
192197 "m-0 min-h-[20px] w-full p-0 text-sm leading-[20px] text-light-950 outline-none focus-visible:outline-none dark:text-dark-950" ,
193198 viewOnly && "cursor-default" ,
@@ -197,7 +202,9 @@ export default function ChecklistItemRow({
197202 if ( viewOnly ) return ;
198203 if ( e . key === "Enter" ) {
199204 e . preventDefault ( ) ;
200- commitTitle ( title ) ;
205+ const innerHTML = ( e . currentTarget as HTMLElement ) . innerHTML ;
206+ commitTitle ( innerHTML ) ;
207+ onCreateNewItem ?.( ) ;
201208 }
202209 if ( e . key === "Escape" ) {
203210 e . preventDefault ( ) ;
Original file line number Diff line number Diff line change @@ -210,6 +210,9 @@ export default function Checklists({
210210 completed : item . completed ,
211211 } }
212212 cardPublicId = { cardPublicId }
213+ onCreateNewItem = { ( ) =>
214+ setActiveChecklistForm ?.( checklist . publicId )
215+ }
213216 viewOnly = { viewOnly }
214217 dragHandleProps = { provided . dragHandleProps }
215218 isDragging = { snapshot . isDragging }
You can’t perform that action at this time.
0 commit comments