diff --git a/src/Collectives.vue b/src/Collectives.vue index 536a323db..8fd86f308 100644 --- a/src/Collectives.vue +++ b/src/Collectives.vue @@ -183,4 +183,10 @@ export default { .app-navigation .app-navigation-toggle { top: 0 !important; } + +/* Fix for anchor scroll and sticky header */ +.splitpanes__pane-details { + scroll-padding-top: 60px; + scroll-behavior: smooth; +} diff --git a/src/mixins/editorMixin.js b/src/mixins/editorMixin.js index ef769d10e..59e2101a2 100644 --- a/src/mixins/editorMixin.js +++ b/src/mixins/editorMixin.js @@ -86,7 +86,15 @@ export default { onOutlineToggle: (visible) => { this.toggleOutlineFromEditor(visible) }, + onLoaded: () => { + if (document.location.hash) { + // scroll to the corresponding header if the page was loaded with a hash + const element = document.querySelector(`[href="${document.location.hash}"]`) + element?.click() + } + }, }) + if (!this.loading('pageContent')) { this.reader.setContent(this.pageContent) }