@@ -8,6 +8,7 @@ import { commonGitHubOptions, prepareGitHubHighlighter } from './github-common'
88const GH_EDIT = 'GH_EDIT' as const
99
1010export interface GitHubEditSpot extends CommentSpot {
11+ isIssue : boolean
1112 type : typeof GH_EDIT
1213}
1314
@@ -22,9 +23,10 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
2223 }
2324
2425 // Only enhance textareas that are for editing issue/PR body
25- const isIssueBodyEdit = textarea . closest ( '.react-issue-body' )
26+ const isIssueBodyEdit = textarea . closest ( '.react-issue-body' ) // this works for root and appended comments
2627 const isPRBodyEdit =
27- textarea . id ?. match ( / ^ i s s u e - \d + - b o d y $ / ) || textarea . name === 'pull_request[body]'
28+ textarea . name === 'pull_request[body]' || textarea . name === 'issue_comment[body]'
29+ // ^this is the root pr comment ^this is the other pr comments (surprising!)
2830
2931 if ( ! isIssueBodyEdit && ! isPRBodyEdit ) {
3032 return null
@@ -42,20 +44,23 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
4244
4345 logger . debug ( `${ this . constructor . name } enhanced issue/PR body textarea` , unique_key )
4446 return {
47+ isIssue : ! ! isIssueBodyEdit ,
4548 type : GH_EDIT ,
4649 unique_key,
4750 }
4851 }
4952
50- enhance ( textArea : HTMLTextAreaElement , _spot : GitHubEditSpot ) : OverTypeInstance {
53+ enhance ( textArea : HTMLTextAreaElement , spot : GitHubEditSpot ) : OverTypeInstance {
5154 prepareGitHubHighlighter ( )
5255 const overtypeContainer = modifyDOM ( textArea )
53- return new OverType ( overtypeContainer , {
56+ const overtype = new OverType ( overtypeContainer , {
5457 ...commonGitHubOptions ,
55- minHeight : '102px' ,
56- padding : 'var(--base-size-8)' ,
57- placeholder : 'Add your comment here...' ,
58+ padding : spot . isIssue ? 'var(--base-size-16)' : 'var(--base-size-8)' ,
5859 } ) [ 0 ] !
60+ if ( ! spot . isIssue ) {
61+ // TODO: autoheight not working
62+ }
63+ return overtype
5964 }
6065
6166 tableUpperDecoration ( _spot : GitHubEditSpot ) : React . ReactNode {
0 commit comments