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"
99import { fixupOvertype , modifyDOM } from "../overtype-misc"
1010import {
1111 commonGitHubOptions ,
12- isProjectUrl ,
1312 isInProjectCommentBox ,
13+ isProjectUrl ,
1414 parseProjectIssueParam ,
1515 prepareGitHubHighlighter ,
1616} from "./github-common"
Original file line number Diff line number Diff line change @@ -11,9 +11,8 @@ import { logger } from "@/lib/logger"
1111import { fixupOvertype , modifyDOM } from "../overtype-misc"
1212import {
1313 commonGitHubOptions ,
14- extractProjectIssueTitle ,
15- isProjectUrl ,
1614 isInProjectCommentBox ,
15+ isProjectUrl ,
1716 parseProjectIssueParam ,
1817 prepareGitHubHighlighter ,
1918} from "./github-common"
@@ -29,7 +28,8 @@ export interface GitHubIssueAppendSpot extends CommentSpot {
2928}
3029
3130export class GitHubIssueAppendEnhancer
32- implements CommentEnhancer < GitHubIssueAppendSpot > {
31+ implements CommentEnhancer < GitHubIssueAppendSpot >
32+ {
3333 forSpotTypes ( ) : string [ ] {
3434 return [ GH_ISSUE_APPEND ]
3535 }
@@ -60,7 +60,10 @@ export class GitHubIssueAppendEnhancer
6060 if ( issueInfo ) {
6161 const unique_key = `github.com:${ issueInfo . slug } :${ issueInfo . number } `
6262 // 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 ( ) || ""
6467 return {
6568 domain : location . host ,
6669 number : issueInfo . number ,
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import { logger } from "../../logger"
1010import { fixupOvertype , modifyDOM } from "../overtype-misc"
1111import {
1212 commonGitHubOptions ,
13- extractDialogSlug ,
1413 isProjectUrl ,
1514 prepareGitHubHighlighter ,
1615} from "./github-common"
@@ -25,7 +24,8 @@ export interface GitHubIssueCreateSpot extends CommentSpot {
2524}
2625
2726export class GitHubIssueCreateEnhancer
28- implements CommentEnhancer < GitHubIssueCreateSpot > {
27+ implements CommentEnhancer < GitHubIssueCreateSpot >
28+ {
2929 forSpotTypes ( ) : string [ ] {
3030 return [ GH_ISSUE_CREATE ]
3131 }
@@ -46,8 +46,10 @@ export class GitHubIssueCreateEnhancer
4646 // Check if we're in a "Create new issue" dialog
4747 const dialog = textarea . closest ( '[role="dialog"]' )
4848 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 ] !
5153 const unique_key = `github.com:${ slug } :new`
5254 const titleInput = document . querySelector (
5355 'input[placeholder="Title"]'
Original file line number Diff line number Diff line change @@ -107,26 +107,3 @@ export function parseProjectIssueParam(
107107export function isInProjectCommentBox ( element : HTMLElement ) : boolean {
108108 return ! ! element . closest ( '[class*="Shared-module__CommentBox"]' )
109109}
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