summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@telenet.be>2022-02-12 13:24:49 +0100
committerGitHub <noreply@github.com>2022-02-12 12:24:49 +0000
commitedf85b820d4d281b281b862e3f66f950616eb62c (patch)
tree002ff1692326b98b9d6965d5bbf7c3add3acc564 /web_src
parentc04a4afac1e513297c7b24ef62e92487d0035288 (diff)
downloadgitea-edf85b820d4d281b281b862e3f66f950616eb62c.tar.gz
gitea-edf85b820d4d281b281b862e3f66f950616eb62c.zip
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 <wxiaoguang@gmail.com>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/repo-code.js7
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 1855f86b41..96a923571f 100644
--- a/web_src/js/features/repo-code.js
+++ b/web_src/js/features/repo-code.js
@@ -15,11 +15,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);