Fix line-number and scroll bugs (#33094) (#33095)

Partially backport #33094 

Fix the scroll bug in issue/pr view page.

Fix a JS error when line number exceeds the max
This commit is contained in:
wxiaoguang 2025-01-04 05:50:39 +08:00 committed by GitHub
parent e10d222434
commit fd281518ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 18 deletions

View file

@ -59,7 +59,7 @@ function selectRange($linesEls, $selectionEndEl, $selectionStartEls?) {
copyPermalink.setAttribute('data-url', link);
};
if ($selectionStartEls) {
if ($selectionStartEls && $selectionStartEls[0]) {
let a = parseInt($selectionEndEl[0].getAttribute('rel').slice(1));
let b = parseInt($selectionStartEls[0].getAttribute('rel').slice(1));
let c;