@@ -31,27 +31,59 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
3131
3232 // Check for project draft edit first
3333 const isProjectDraftEdit = location . pathname . match (
34- / ^ \/ (?: o r g s | u s e r s ) \/ [ ^ / ] + \/ p r o j e c t s \/ \d + \/ v i e w s \/ \d + /
34+ / ^ \/ (?: o r g s | u s e r s ) \/ [ ^ / ] + \/ p r o j e c t s \/ \d + (?: \/ v i e w s \/ \d + ) ? /
3535 )
3636 if ( isProjectDraftEdit ) {
3737 const params = new URLSearchParams ( location . search )
3838 const itemId = params . get ( "itemId" )
39- // Exclude textareas within Shared-module__CommentBox (those are for adding new comments, not editing)
40- const isInCommentBox = textarea . closest (
41- '[class*="Shared-module__CommentBox"]'
42- )
43- if ( itemId && textarea . closest ( "[role='dialog']" ) && ! isInCommentBox ) {
44- const unique_key = `github.com:project-draft:${ itemId } :edit-body`
45- logger . debug (
46- `${ this . constructor . name } enhanced project draft body textarea` ,
47- unique_key
39+ const issueParam = params . get ( "issue" )
40+
41+ // Handle draft editing (itemId parameter)
42+ if ( itemId ) {
43+ // Exclude textareas within Shared-module__CommentBox (those are for adding new comments, not editing)
44+ const isInCommentBox = textarea . closest (
45+ '[class*="Shared-module__CommentBox"]'
4846 )
49- return {
50- isIssue : true ,
51- type : GH_EDIT ,
52- unique_key,
47+ if ( textarea . closest ( "[role='dialog']" ) && ! isInCommentBox ) {
48+ const unique_key = `github.com:project-draft:${ itemId } :edit-body`
49+ logger . debug (
50+ `${ this . constructor . name } enhanced project draft body textarea` ,
51+ unique_key
52+ )
53+ return {
54+ isIssue : true ,
55+ type : GH_EDIT ,
56+ unique_key,
57+ }
58+ }
59+ }
60+
61+ // Handle existing issue comment editing (issue parameter)
62+ if ( issueParam ) {
63+ // Parse issue parameter: "owner|repo|number"
64+ const parts = issueParam . split ( "|" )
65+ if ( parts . length === 3 ) {
66+ const [ owner , repo , numberStr ] = parts
67+ const slug = `${ owner } /${ repo } `
68+ const number = parseInt ( numberStr ! , 10 )
69+
70+ // Edit mode: empty placeholder
71+ // Add new comment mode: has placeholder "Add your comment here..." or similar
72+ if ( ! textarea . placeholder || textarea . placeholder . trim ( ) === "" ) {
73+ const unique_key = `github.com:${ slug } :${ number } :edit-comment`
74+ logger . debug (
75+ `${ this . constructor . name } enhanced project issue comment edit textarea` ,
76+ unique_key
77+ )
78+ return {
79+ isIssue : true ,
80+ type : GH_EDIT ,
81+ unique_key,
82+ }
83+ }
5384 }
5485 }
86+
5587 return null
5688 }
5789
0 commit comments