From 2a3ed74402bee1247fca09f735f5b3cc4f047c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Fri, 8 Mar 2024 11:43:30 +0100 Subject: [PATCH] level up methods --- .../src/packages/core/router/route.context.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/router/route.context.ts b/src/Umbraco.Web.UI.Client/src/packages/core/router/route.context.ts index 70a2198629..c72a5b1bd4 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/router/route.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/router/route.context.ts @@ -31,6 +31,19 @@ export class UmbRouteContext extends UmbControllerBase { }); } + public navigateLevelUp() { + const path = this.getLevelUpPath(); + if (path) { + window.history.pushState({}, '', path); + } + } + public getLevelUpPath() { + if (this.#routerBasePath) { + return this.#routerBasePath.endsWith('/') ? this.#routerBasePath : this.#routerBasePath + '/'; + } + return; + } + public registerModal(registration: UmbModalRouteRegistration) { this.#modalRegistrations.push(registration); this.#createNewUrlBuilder(registration);