Fix source code line highlighting (#18729)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
tokarchuk/v1.17
Jimmy Praet 3 years ago committed by GitHub
parent 91ac65db5e
commit 9444135ff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      web_src/js/features/repo-code.js

@ -16,11 +16,14 @@ function selectRange($list, $select, $from) {
const $issue = $('a.ref-in-new-issue'); const $issue = $('a.ref-in-new-issue');
const $copyPermalink = $('a.copy-line-permalink'); const $copyPermalink = $('a.copy-line-permalink');
if ($issue.length === 0 || $copyPermalink.length === 0) { if ($copyPermalink.length === 0) {
return; return;
} }
const updateIssueHref = function (anchor) { const updateIssueHref = function (anchor) {
if ($issue.length === 0) {
return;
}
let href = $issue.attr('href'); let href = $issue.attr('href');
href = `${href.replace(/%23L\d+$|%23L\d+-L\d+$/, '')}%23${anchor}`; href = `${href.replace(/%23L\d+$|%23L\d+-L\d+$/, '')}%23${anchor}`;
$issue.attr('href', href); $issue.attr('href', href);

Loading…
Cancel
Save