Fix source code navigate bug. Fix #212

This commit is contained in:
Folyd 2022-11-15 21:55:27 +08:00
parent 75da853caa
commit a4f1808aca
2 changed files with 3 additions and 2 deletions

View file

@ -118,7 +118,7 @@ async function getFeatureFlagsMenuData() {
let optionalDependencies = parseOptionalDependencies(depsContent); let optionalDependencies = parseOptionalDependencies(depsContent);
return { features, optionalDependencies }; return { features, optionalDependencies };
}; }
async function enhanceFeatureFlagsMenu(menu) { async function enhanceFeatureFlagsMenu(menu) {
let crateData = JSON.parse(window.sessionStorage.getItem(`${rawCrateName}-${crateVersion}`)); let crateData = JSON.parse(window.sessionStorage.getItem(`${rawCrateName}-${crateVersion}`));

View file

@ -9,7 +9,8 @@ document.addEventListener("DOMContentLoaded", () => {
// We fallback to the "srclink" of Option. // We fallback to the "srclink" of Option.
let hash = currentUrl.hash.replace(/#(variant\.)?/i, ""); let hash = currentUrl.hash.replace(/#(variant\.)?/i, "");
let element = document.getElementById(hash) let element = document.getElementById(hash)
|| document.querySelector(".fqn"); || document.querySelector(".out-of-band");
if (element) { if (element) {
let srclink = element.querySelector(".srclink"); let srclink = element.querySelector(".srclink");
location.href = srclink.href; location.href = srclink.href;