mirror of
https://github.com/Redocly/redoc.git
synced 2025-07-31 10:29:47 +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);
|
||||
|
||||
// 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;
|
||||
setSelectedIdx(idx);
|
||||
return setOpen(false);
|
||||
|
|
Loading…
Reference in New Issue
Block a user