@@ -438,22 +438,24 @@ export async function handleReply($el) {
438
438
439
439
export function initRepoPullRequestReview ( ) {
440
440
if ( window . location . hash && window . location . hash . startsWith ( '#issuecomment-' ) ) {
441
+ ( history . scrollRestoration != 'manual' ) && ( history . scrollRestoration = 'manual' ) ;
441
442
const commentDiv = $ ( window . location . hash ) ;
442
- console . log ( commentDiv [ 0 ] )
443
443
if ( commentDiv ) {
444
444
// get the name of the parent id
445
445
const groupID = commentDiv . closest ( 'div[id^="code-comments-"]' ) . attr ( 'id' ) ;
446
- const ancestorDiffHeader = commentDiv . closest ( '.diff-file-box' ) . children ( '.diff-file-header' ) . eq ( 0 ) [ 0 ] ;
447
- console . log ( ancestorDiffHeader )
448
- setFileFolding ( ancestorDiffHeader . closest ( '.file-content' ) , ancestorDiffHeader . querySelector ( '.fold-file' ) , false ) ;
449
446
if ( groupID && groupID . startsWith ( 'code-comments-' ) ) {
450
447
const id = groupID . slice ( 14 ) ;
448
+ const ancestorDiffHeader = commentDiv . closest ( '.diff-file-box' ) . children ( '.diff-file-header' ) . eq ( 0 ) [ 0 ] ;
451
449
$ ( `#show-outdated-${ id } ` ) . addClass ( 'gt-hidden' ) ;
452
450
$ ( `#code-comments-${ id } ` ) . removeClass ( 'gt-hidden' ) ;
453
451
$ ( `#code-preview-${ id } ` ) . removeClass ( 'gt-hidden' ) ;
454
452
$ ( `#hide-outdated-${ id } ` ) . removeClass ( 'gt-hidden' ) ;
455
- console . log ( 'scrollIntoView' )
456
- commentDiv [ 0 ] . scrollIntoView ( ) ;
453
+ setFileFolding ( ancestorDiffHeader . closest ( '.file-content' ) , ancestorDiffHeader . querySelector ( '.fold-file' ) , false ) ;
454
+ commentDiv [ 0 ] . scrollIntoView ( {
455
+ behavior : 'auto' ,
456
+ block : 'center' ,
457
+ inline : 'center'
458
+ } ) ;
457
459
}
458
460
}
459
461
}
0 commit comments