diff --git a/client/src/app/shared/shared-plugin-pages/plugin-pages.component.html b/client/src/app/shared/shared-plugin-pages/plugin-pages.component.html index cf62d1bd7..7a1eb654f 100644 --- a/client/src/app/shared/shared-plugin-pages/plugin-pages.component.html +++ b/client/src/app/shared/shared-plugin-pages/plugin-pages.component.html @@ -1 +1 @@ -
+
diff --git a/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts b/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts index 2111ac7b7..36d05766b 100644 --- a/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts +++ b/client/src/app/shared/shared-plugin-pages/plugin-pages.component.ts @@ -32,6 +32,25 @@ export class PluginPagesComponent implements OnDestroy, AfterViewInit { if (this.urlSub) this.urlSub.unsubscribe() } + onRootClick (event: Event) { + const target = event.target as HTMLElement + + if (!target) return + if (target.tagName !== 'A') return + + const a = target as HTMLAnchorElement + + // Get the href attribute set by the dev, not the one calculated by JS to detect if it's a relative/external link + const href = a.getAttribute('href') + + if (a.target !== '_blank' && !href.match(/^https?:\/\//)) { + event.preventDefault() + event.stopPropagation() + + this.router.navigateByUrl(href) + } + } + private async loadRoute () { await this.pluginService.ensurePluginsAreLoaded(this.route.snapshot.data.pluginScope || 'common')