mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-01 19:00:21 +03:00
DOP-3610: relative anchor tag persisted on version change (#31)
This commit is contained in:
parent
176757f5ab
commit
e161724135
|
@ -37,7 +37,11 @@ const VersionSelectorComponent = ({
|
||||||
if (idx === selectedIdx) return setOpen(false);
|
if (idx === selectedIdx) return setOpen(false);
|
||||||
|
|
||||||
// navigate to resource version spec
|
// navigate to resource version spec
|
||||||
const selectedResourceVersionUrl = `${rootUrl}/${resourceVersion}`;
|
let selectedResourceVersionUrl = `${rootUrl}/${resourceVersion}`;
|
||||||
|
const anchorTagIdx = window.location.href.indexOf('#tag');
|
||||||
|
if (anchorTagIdx > -1) {
|
||||||
|
selectedResourceVersionUrl += window.location.href.slice(anchorTagIdx);
|
||||||
|
}
|
||||||
window.location.href = selectedResourceVersionUrl;
|
window.location.href = selectedResourceVersionUrl;
|
||||||
setSelectedIdx(idx);
|
setSelectedIdx(idx);
|
||||||
return setOpen(false);
|
return setOpen(false);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user