From 7f555bbe115f3b885c6c91ccf5a6c17c6ae7ba73 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 28 Jan 2019 15:38:53 +0100 Subject: [PATCH] update urls on TOC click --- src/templates/Typedoc/TocScroll.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/templates/Typedoc/TocScroll.jsx b/src/templates/Typedoc/TocScroll.jsx index 049e0d7e..c94ff3dc 100644 --- a/src/templates/Typedoc/TocScroll.jsx +++ b/src/templates/Typedoc/TocScroll.jsx @@ -41,6 +41,11 @@ export default class TocScroll extends React.Component { scroll ? this.scrollTo(elem, offset, timeout) : console.log(`Element not found: ${element}`) // eslint-disable-line + + // update browser url + if (typeof window !== 'undefined') { + window.history.pushState({}, null, `#${element}`) + } } scrollTo(element, offSet = 0, timeout = null) {