@@ -22,38 +22,29 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
2222 return null
2323 }
2424
25- // Only enhance textareas that are for editing issue/PR body
26- const isIssueBodyEdit = textarea . closest ( '.react-issue-body' ) // this works for root and appended comments
27- const isPRBodyEdit =
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!)
30-
31- // Also detect comment editing textareas (have "Update comment" button)
32- // Look for "Update comment" button in the same container as the textarea
33- const container =
34- textarea . closest ( '[class*="markdown"], [class*="comment"], .js-comment-edit-form' ) ||
35- textarea . closest ( 'form' ) ||
36- textarea . parentElement ?. parentElement ?. parentElement
37- const buttons = container ? Array . from ( container . querySelectorAll ( 'button' ) ) : [ ]
38- const isCommentEdit = buttons . some ( ( btn ) => btn . textContent ?. includes ( 'Update comment' ) )
39-
40- if ( ! isIssueBodyEdit && ! isPRBodyEdit && ! isCommentEdit ) {
41- return null
42- }
43-
4425 // Parse GitHub URL structure: /owner/repo/issues/123 or /owner/repo/pull/456
4526 const match = location . pathname . match ( / ^ \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ (?: i s s u e s | p u l l ) \/ ( \d + ) / )
4627 if ( ! match ) {
4728 return null
4829 }
49-
5030 const [ , owner , repo , numberStr ] = match
5131 const number = parseInt ( numberStr ! , 10 )
5232 const unique_key = `github.com:${ owner } /${ repo } :${ number } :edit-body`
5333
34+ // Only enhance textareas that are for editing issue/PR body
35+ const isIssueBodyRootEdit = textarea . closest ( '.react-issue-body' )
36+ const isIssueBodyCommentEdit = textarea . closest ( '[data-wrapper-timeline-id]' )
37+ const isPRBodyEdit =
38+ textarea . name === 'pull_request[body]' || textarea . name === 'issue_comment[body]'
39+ // ^this is the root pr comment ^this is the other pr comments (surprising!)
40+
41+ if ( ! isIssueBodyRootEdit && ! isIssueBodyCommentEdit && ! isPRBodyEdit ) {
42+ return null
43+ }
44+
5445 logger . debug ( `${ this . constructor . name } enhanced issue/PR body textarea` , unique_key )
5546 return {
56- isIssue : ! ! isIssueBodyEdit ,
47+ isIssue : ! ! ( isIssueBodyRootEdit || isIssueBodyCommentEdit ) ,
5748 type : GH_EDIT ,
5849 unique_key,
5950 }
0 commit comments