File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -413,8 +413,6 @@ export function AddComment({
413
413
}
414
414
: commentMethods ( isIssue ) ;
415
415
416
- const commentStartingText = pendingCommentText ?? ( isCopilotOnMyBehalf ? '@copilot ' : '' ) ;
417
-
418
416
return (
419
417
< form id = "comment-form" ref = { form as React . MutableRefObject < HTMLFormElement > } className = "comment-form main-comment-form" onSubmit = { ( ) => submit ( textareaRef . current ?. value ?? '' ) } >
420
418
< textarea
@@ -423,8 +421,14 @@ export function AddComment({
423
421
ref = { textareaRef as React . MutableRefObject < HTMLTextAreaElement > }
424
422
onInput = { ( { target } ) => updatePR ( { pendingCommentText : ( target as any ) . value } ) }
425
423
onKeyDown = { onKeyDown }
426
- value = { commentStartingText }
424
+ value = { pendingCommentText }
427
425
placeholder = "Leave a comment"
426
+ onClick = { ( ) => {
427
+ if ( ! pendingCommentText && isCopilotOnMyBehalf && ! textareaRef . current ?. textContent ) {
428
+ textareaRef . current ! . textContent = '@copilot ' ;
429
+ textareaRef . current ! . setSelectionRange ( 9 , 9 ) ;
430
+ }
431
+ } }
428
432
/>
429
433
< div className = "form-actions" >
430
434
{ ( hasWritePermission || isAuthor ) ? (
You can’t perform that action at this time.
0 commit comments