Skip to content

Commit

Permalink
Fix source code line highlighting (go-gitea#18729)
Browse files Browse the repository at this point in the history
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
  • Loading branch information
2 people authored and Stelios Malathouras committed Mar 28, 2022
1 parent ddafae5 commit 0a24f01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web_src/js/features/repo-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ function selectRange($list, $select, $from) {
const $issue = $('a.ref-in-new-issue');
const $copyPermalink = $('a.copy-line-permalink');

if ($issue.length === 0 || $copyPermalink.length === 0) {
if ($copyPermalink.length === 0) {
return;
}

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

0 comments on commit 0a24f01

Please sign in to comment.