File tree Expand file tree Collapse file tree 4 files changed +14
-32
lines changed Expand file tree Collapse file tree 4 files changed +14
-32
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ import { logger } from "@/lib/logger"
9
9
import { fixupOvertype , modifyDOM } from "../overtype-misc"
10
10
import {
11
11
commonGitHubOptions ,
12
- isProjectUrl ,
13
12
isInProjectCommentBox ,
13
+ isProjectUrl ,
14
14
parseProjectIssueParam ,
15
15
prepareGitHubHighlighter ,
16
16
} from "./github-common"
Original file line number Diff line number Diff line change @@ -11,9 +11,8 @@ import { logger } from "@/lib/logger"
11
11
import { fixupOvertype , modifyDOM } from "../overtype-misc"
12
12
import {
13
13
commonGitHubOptions ,
14
- extractProjectIssueTitle ,
15
- isProjectUrl ,
16
14
isInProjectCommentBox ,
15
+ isProjectUrl ,
17
16
parseProjectIssueParam ,
18
17
prepareGitHubHighlighter ,
19
18
} from "./github-common"
@@ -29,7 +28,8 @@ export interface GitHubIssueAppendSpot extends CommentSpot {
29
28
}
30
29
31
30
export class GitHubIssueAppendEnhancer
32
- implements CommentEnhancer < GitHubIssueAppendSpot > {
31
+ implements CommentEnhancer < GitHubIssueAppendSpot >
32
+ {
33
33
forSpotTypes ( ) : string [ ] {
34
34
return [ GH_ISSUE_APPEND ]
35
35
}
@@ -60,7 +60,10 @@ export class GitHubIssueAppendEnhancer
60
60
if ( issueInfo ) {
61
61
const unique_key = `github.com:${ issueInfo . slug } :${ issueInfo . number } `
62
62
// For project views, the title is in the side panel dialog
63
- const title = extractProjectIssueTitle ( )
63
+ const title =
64
+ document
65
+ . querySelector ( '[data-testid="issue-title"]' )
66
+ ?. textContent ?. trim ( ) || ""
64
67
return {
65
68
domain : location . host ,
66
69
number : issueInfo . number ,
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import { logger } from "../../logger"
10
10
import { fixupOvertype , modifyDOM } from "../overtype-misc"
11
11
import {
12
12
commonGitHubOptions ,
13
- extractDialogSlug ,
14
13
isProjectUrl ,
15
14
prepareGitHubHighlighter ,
16
15
} from "./github-common"
@@ -25,7 +24,8 @@ export interface GitHubIssueCreateSpot extends CommentSpot {
25
24
}
26
25
27
26
export class GitHubIssueCreateEnhancer
28
- implements CommentEnhancer < GitHubIssueCreateSpot > {
27
+ implements CommentEnhancer < GitHubIssueCreateSpot >
28
+ {
29
29
forSpotTypes ( ) : string [ ] {
30
30
return [ GH_ISSUE_CREATE ]
31
31
}
@@ -46,8 +46,10 @@ export class GitHubIssueCreateEnhancer
46
46
// Check if we're in a "Create new issue" dialog
47
47
const dialog = textarea . closest ( '[role="dialog"]' )
48
48
if ( dialog ) {
49
- const slug = extractDialogSlug ( dialog )
50
- if ( slug ) {
49
+ const dialogHeading = dialog . querySelector ( "h1" ) ?. textContent
50
+ const slugMatch = dialogHeading ?. match ( / C r e a t e n e w i s s u e i n ( .+ ) / )
51
+ if ( slugMatch ) {
52
+ const slug = slugMatch [ 1 ] !
51
53
const unique_key = `github.com:${ slug } :new`
52
54
const titleInput = document . querySelector (
53
55
'input[placeholder="Title"]'
Original file line number Diff line number Diff line change @@ -107,26 +107,3 @@ export function parseProjectIssueParam(
107
107
export function isInProjectCommentBox ( element : HTMLElement ) : boolean {
108
108
return ! ! element . closest ( '[class*="Shared-module__CommentBox"]' )
109
109
}
110
-
111
- /**
112
- * Extract the issue title from a project view.
113
- * Used when viewing issues within a project board.
114
- */
115
- export function extractProjectIssueTitle ( ) : string {
116
- return (
117
- document
118
- . querySelector ( '[data-testid="issue-title"]' )
119
- ?. textContent ?. trim ( ) || ""
120
- )
121
- }
122
-
123
- /**
124
- * Extract the repository slug from a "Create new issue" dialog heading.
125
- * Heading format: "Create new issue in owner/repo"
126
- * Returns: "owner/repo" or null if not found
127
- */
128
- export function extractDialogSlug ( dialog : Element ) : string | null {
129
- const dialogHeading = dialog . querySelector ( "h1" ) ?. textContent
130
- const slugMatch = dialogHeading ?. match ( / C r e a t e n e w i s s u e i n ( .+ ) / )
131
- return slugMatch ? slugMatch [ 1 ] ! : null
132
- }
You can’t perform that action at this time.
0 commit comments