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({
413413 }
414414 : commentMethods ( isIssue ) ;
415415
416- const commentStartingText = pendingCommentText ?? ( isCopilotOnMyBehalf ? '@copilot ' : '' ) ;
417-
418416 return (
419417 < form id = "comment-form" ref = { form as React . MutableRefObject < HTMLFormElement > } className = "comment-form main-comment-form" onSubmit = { ( ) => submit ( textareaRef . current ?. value ?? '' ) } >
420418 < textarea
@@ -423,8 +421,14 @@ export function AddComment({
423421 ref = { textareaRef as React . MutableRefObject < HTMLTextAreaElement > }
424422 onInput = { ( { target } ) => updatePR ( { pendingCommentText : ( target as any ) . value } ) }
425423 onKeyDown = { onKeyDown }
426- value = { commentStartingText }
424+ value = { pendingCommentText }
427425 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+ } }
428432 />
429433 < div className = "form-actions" >
430434 { ( hasWritePermission || isAuthor ) ? (
You can’t perform that action at this time.
0 commit comments