]> source.dussan.org Git - gitea.git/commitdiff
Fix source code line highlighting (#18729)
authorJimmy Praet <jimmy.praet@telenet.be>
Sat, 12 Feb 2022 05:00:24 +0000 (06:00 +0100)
committerGitHub <noreply@github.com>
Sat, 12 Feb 2022 05:00:24 +0000 (05:00 +0000)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
web_src/js/features/repo-code.js

index cc3019c236322a0dae5de1365ba232af2eae5fe6..82ab902ce1eddced828decf5e651cacecffaffd0 100644 (file)
@@ -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);