Skip to content

Commit edf85b8

Browse files
jpraetwxiaoguang
andauthored
Fix source code line highlighting (#18729) (#18740)
Backport #18729 When the issues repo unit is disabled, or an external issue tracker is used, there is no "a.ref-in-new-issue". Fixes #18721 Co-authored-by: wxiaoguang <[email protected]>
1 parent c04a4af commit edf85b8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web_src/js/features/repo-code.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ function selectRange($list, $select, $from) {
1515
const $issue = $('a.ref-in-new-issue');
1616
const $copyPermalink = $('a.copy-line-permalink');
1717

18-
if ($issue.length === 0 || $copyPermalink.length === 0) {
18+
if ($copyPermalink.length === 0) {
1919
return;
2020
}
2121

22-
const updateIssueHref = function(anchor) {
22+
const updateIssueHref = function (anchor) {
23+
if ($issue.length === 0) {
24+
return;
25+
}
2326
let href = $issue.attr('href');
2427
href = `${href.replace(/%23L\d+$|%23L\d+-L\d+$/, '')}%23${anchor}`;
2528
$issue.attr('href', href);

0 commit comments

Comments
 (0)