File tree Expand file tree Collapse file tree
packages/ui/src/components/editor/panel/Tasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change 157157 }
158158}
159159
160+ .add-row {
161+ position : relative ;
162+ display : flex ;
163+
164+ & :hover {
165+ background-color : var (--vscode-list-hoverBackground );
166+
167+ .add-button ::before {
168+ opacity : 1 ;
169+ }
170+ }
171+ }
172+
160173.empty {
161174 padding : 8px 12px ;
162175 font-size : 11px ;
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ export const TaskGroup: React.FC<TaskGroupProps> = (props) => {
7070 } ) }
7171 </ ReactSortable >
7272 { props . on_add && (
73- < div style = { { position : 'relative' , display : 'flex' } } >
73+ < div className = { styles [ 'add-row' ] } onClick = { props . on_add } >
7474 { [ ...Array ( depth ) ] . map ( ( _ , i ) => (
7575 < div
7676 key = { i }
@@ -80,7 +80,6 @@ export const TaskGroup: React.FC<TaskGroupProps> = (props) => {
8080 ) ) }
8181 < button
8282 className = { cn ( styles [ 'add-button' ] , styles [ 'add-button--add' ] ) }
83- onClick = { props . on_add }
8483 style = { { marginLeft : `${ 13 + depth * 20 } px` } }
8584 title = "Add task"
8685 />
Original file line number Diff line number Diff line change @@ -10,9 +10,12 @@ export const use_auto_focus_new_task = (
1010
1111 useEffect ( ( ) => {
1212 const current_ids = new Set < number > ( )
13+ const id_to_task = new Map < number , Task > ( )
14+
1315 const collect_ids = ( t : Task [ ] ) => {
1416 t . forEach ( ( task ) => {
1517 current_ids . add ( task . created_at )
18+ id_to_task . set ( task . created_at , task )
1619 if ( task . children ) collect_ids ( task . children )
1720 } )
1821 }
@@ -29,7 +32,10 @@ export const use_auto_focus_new_task = (
2932 )
3033
3134 if ( added_ids . length === 1 ) {
32- set_editing_timestamp ( added_ids [ 0 ] )
35+ const new_task = id_to_task . get ( added_ids [ 0 ] )
36+ if ( new_task && new_task . text === '' ) {
37+ set_editing_timestamp ( added_ids [ 0 ] )
38+ }
3339 }
3440
3541 prev_ids_ref . current = current_ids
You can’t perform that action at this time.
0 commit comments