Add workspace view path const (#17880)
* use path const for workspace view * get base path and active path from router context --------- Co-authored-by: Kenn Jacobsen <kja@umbraco.dk>
This commit is contained in:
@@ -37,6 +37,13 @@ export class UmbRouteContext extends UmbContextBase<UmbRouteContext> {
|
||||
});
|
||||
}
|
||||
|
||||
getBasePath() {
|
||||
return this.#basePath.getValue();
|
||||
}
|
||||
getActivePath() {
|
||||
return this.getBasePath() + '/' + this.#activeLocalPath;
|
||||
}
|
||||
|
||||
public registerModal(registration: UmbModalRouteRegistration) {
|
||||
this.#modalRegistrations.push(registration);
|
||||
this.#createNewUrlBuilder(registration);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { createExtensionElement, UmbExtensionsManifestInitializer } from '@umbra
|
||||
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
|
||||
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
|
||||
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
|
||||
import type { ManifestWorkspaceView } from '@umbraco-cms/backoffice/workspace';
|
||||
import { UMB_WORKSPACE_VIEW_PATH_PATTERN, type ManifestWorkspaceView } from '@umbraco-cms/backoffice/workspace';
|
||||
import type { UmbRoute, UmbRouterSlotInitEvent, UmbRouterSlotChangeEvent } from '@umbraco-cms/backoffice/router';
|
||||
|
||||
/**
|
||||
@@ -62,7 +62,7 @@ export class UmbWorkspaceEditorElement extends UmbLitElement {
|
||||
if (this._workspaceViews.length > 0) {
|
||||
newRoutes = this._workspaceViews.map((manifest) => {
|
||||
return {
|
||||
path: `view/${manifest.meta.pathname}`,
|
||||
path: UMB_WORKSPACE_VIEW_PATH_PATTERN.generateLocal({ viewPathname: manifest.meta.pathname }),
|
||||
component: () => createExtensionElement(manifest),
|
||||
setup: (component) => {
|
||||
if (component) {
|
||||
|
||||
@@ -5,3 +5,8 @@ export const UMB_WORKSPACE_PATH_PATTERN = new UmbPathPattern<
|
||||
{ entityType: string },
|
||||
typeof UMB_SECTION_PATH_PATTERN.ABSOLUTE_PARAMS
|
||||
>('workspace/:entityType', UMB_SECTION_PATH_PATTERN);
|
||||
|
||||
export const UMB_WORKSPACE_VIEW_PATH_PATTERN = new UmbPathPattern<
|
||||
{ viewPathname: string },
|
||||
typeof UMB_WORKSPACE_PATH_PATTERN.ABSOLUTE_PARAMS
|
||||
>('view/:viewPathname', UMB_WORKSPACE_PATH_PATTERN);
|
||||
|
||||
Reference in New Issue
Block a user