diff options
author | Jimmy Praet <jimmy.praet@telenet.be> | 2022-02-12 06:00:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 05:00:24 +0000 |
commit | 9444135ff5fe5e6929fc945ad0f40d77ca17c340 (patch) | |
tree | 7d64fa4eb9e01c2df5677f6c49950a80db845e16 | |
parent | 91ac65db5ecac7c665b18a693720742434eb02cf (diff) | |
download | gitea-9444135ff5fe5e6929fc945ad0f40d77ca17c340.tar.gz gitea-9444135ff5fe5e6929fc945ad0f40d77ca17c340.zip |
Fix source code line highlighting (#18729)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
-rw-r--r-- | web_src/js/features/repo-code.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/web_src/js/features/repo-code.js b/web_src/js/features/repo-code.js index cc3019c236..82ab902ce1 100644 --- a/web_src/js/features/repo-code.js +++ b/web_src/js/features/repo-code.js @@ -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); |