File tree Expand file tree Collapse file tree 3 files changed +86
-11
lines changed
tests/lib/enhancers/__snapshots__ Expand file tree Collapse file tree 3 files changed +86
-11
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,28 @@ export class GitHubEditEnhancer implements CommentEnhancer<GitHubEditSpot> {
29
29
return null
30
30
}
31
31
32
+ // Check for project draft edit first
33
+ 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 + /
35
+ )
36
+ if ( isProjectDraftEdit ) {
37
+ const params = new URLSearchParams ( location . search )
38
+ const itemId = params . get ( "itemId" )
39
+ if ( itemId && textarea . closest ( "[role='dialog']" ) ) {
40
+ const unique_key = `github.com:project-draft:${ itemId } :edit-body`
41
+ logger . debug (
42
+ `${ this . constructor . name } enhanced project draft body textarea` ,
43
+ unique_key
44
+ )
45
+ return {
46
+ isIssue : true ,
47
+ type : GH_EDIT ,
48
+ unique_key,
49
+ }
50
+ }
51
+ return null
52
+ }
53
+
32
54
// Parse GitHub URL structure: /owner/repo/issues/123 or /owner/repo/pull/456
33
55
const match = location . pathname . match (
34
56
/ ^ \/ ( [ ^ / ] + ) \/ ( [ ^ / ] + ) \/ (?: i s s u e s | p u l l ) \/ ( \d + ) /
Original file line number Diff line number Diff line change @@ -224,30 +224,46 @@ exports[`github detection > gh_project_draft:should detect correct spots 1`] = `
224
224
exports [` github detection > gh_project_draft_edit:should detect correct spots 1` ] = `
225
225
[
226
226
{
227
- " for" : " id=:r5a: name=null className=prc-Textarea-TextArea-13q4j" ,
228
- " spot" : " NO_SPOT" ,
227
+ " for" : " id=:r5a: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
228
+ " spot" : {
229
+ " isIssue" : true ,
230
+ " type" : " GH_EDIT" ,
231
+ " unique_key" : " github.com:project-draft:129503329:edit-body" ,
232
+ },
229
233
} ,
230
234
]
231
235
` ;
232
236
233
237
exports [` github detection > gh_project_issue:should detect correct spots 1` ] = `
234
238
[
235
239
{
236
- " for" : " id=:rbs: name=null className=prc-Textarea-TextArea-13q4j" ,
237
- " spot" : " NO_SPOT" ,
240
+ " for" : " id=:rbs: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
241
+ " spot" : {
242
+ " isIssue" : true ,
243
+ " type" : " GH_EDIT" ,
244
+ " unique_key" : " github.com:project-draft:129503239:edit-body" ,
245
+ },
238
246
} ,
239
247
]
240
248
` ;
241
249
242
250
exports [` github detection > gh_project_issue_edit:should detect correct spots 1` ] = `
243
251
[
244
252
{
245
- " for" : " id=:rdh: name=null className=prc-Textarea-TextArea-13q4j" ,
246
- " spot" : " NO_SPOT" ,
253
+ " for" : " id=:rdh: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
254
+ " spot" : {
255
+ " isIssue" : true ,
256
+ " type" : " GH_EDIT" ,
257
+ " unique_key" : " github.com:project-draft:129503239:edit-body" ,
258
+ },
247
259
} ,
248
260
{
249
- " for" : " id=:rbs: name=null className=prc-Textarea-TextArea-13q4j" ,
250
- " spot" : " NO_SPOT" ,
261
+ " for" : " id=:rbs: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
262
+ " spot" : {
263
+ " isIssue" : true ,
264
+ " type" : " GH_EDIT" ,
265
+ " unique_key" : " github.com:project-draft:129503239:edit-body" ,
266
+ },
251
267
} ,
252
268
]
253
269
` ;
Original file line number Diff line number Diff line change @@ -274,8 +274,45 @@ exports[`github ui > gh_project:should render correct UI elements 1`] = `[]`;
274
274
275
275
exports [` github ui > gh_project_draft:should render correct UI elements 1` ] = ` []` ;
276
276
277
- exports [` github ui > gh_project_draft_edit:should render correct UI elements 1` ] = ` []` ;
277
+ exports [` github ui > gh_project_draft_edit:should render correct UI elements 1` ] = `
278
+ [
279
+ {
280
+ " for" : " id=:r5a: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
281
+ " title" : " N/A" ,
282
+ " upperDecoration" : <span >
283
+ N/A
284
+ </span >,
285
+ } ,
286
+ ]
287
+ ` ;
278
288
279
- exports [` github ui > gh_project_issue:should render correct UI elements 1` ] = ` []` ;
289
+ exports [` github ui > gh_project_issue:should render correct UI elements 1` ] = `
290
+ [
291
+ {
292
+ " for" : " id=:rbs: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
293
+ " title" : " N/A" ,
294
+ " upperDecoration" : <span >
295
+ N/A
296
+ </span >,
297
+ } ,
298
+ ]
299
+ ` ;
280
300
281
- exports [` github ui > gh_project_issue_edit:should render correct UI elements 1` ] = ` []` ;
301
+ exports [` github ui > gh_project_issue_edit:should render correct UI elements 1` ] = `
302
+ [
303
+ {
304
+ " for" : " id=:rdh: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
305
+ " title" : " N/A" ,
306
+ " upperDecoration" : <span >
307
+ N/A
308
+ </span >,
309
+ } ,
310
+ {
311
+ " for" : " id=:rbs: name=null className=prc-Textarea-TextArea-13q4j overtype-input" ,
312
+ " title" : " N/A" ,
313
+ " upperDecoration" : <span >
314
+ N/A
315
+ </span >,
316
+ } ,
317
+ ]
318
+ ` ;
You can’t perform that action at this time.
0 commit comments