1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00

Fix Anchor jumping with escaped query components (#14969) (#14977)

Backport #14969

Fix #14968

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2021-03-13 09:54:53 +00:00 committed by GitHub
parent 3231b70043
commit 71a2adbf10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@ const headingSelector = '.markdown h1, .markdown h2, .markdown h3, .markdown h4,
function scrollToAnchor() {
if (document.querySelector(':target')) return;
if (!window.location.hash || window.location.hash.length <= 1) return;
const id = window.location.hash.substring(1);
const id = decodeURIComponent(window.location.hash.substring(1));
const el = document.getElementById(`user-content-${id}`);
if (el) {
el.scrollIntoView();