Fix blame page select range error and some typos (#19503)

Partially back port from #19500 and fix two typos.
This commit is contained in:
Lunny Xiao 2022-04-27 03:19:52 +08:00 committed by GitHub
parent 242f7f1a52
commit b31418edd9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 6 deletions

View file

@ -15,10 +15,6 @@ function selectRange($list, $select, $from) {
const $issue = $('a.ref-in-new-issue');
const $copyPermalink = $('a.copy-line-permalink');
if ($copyPermalink.length === 0) {
return;
}
const updateIssueHref = function (anchor) {
if ($issue.length === 0) {
return;
@ -29,6 +25,9 @@ function selectRange($list, $select, $from) {
};
const updateCopyPermalinkHref = function(anchor) {
if ($copyPermalink.length === 0) {
return;
}
let link = $copyPermalink.attr('data-clipboard-text');
link = `${link.replace(/#L\d+$|#L\d+-L\d+$/, '')}#${anchor}`;
$copyPermalink.attr('data-clipboard-text', link);