up-doc-workflow-workspace.context.ts
Workspace context and editor element for individual workflow pages. Provides routing, state management, and the editor shell for the workflow workspace.
What it does
Section titled “What it does”Contains two exports:
UpDocWorkflowWorkspaceEditorElement— A minimal Lit element that renders<umb-workspace-editor>with a dynamic headlineUpDocWorkflowWorkspaceContext— The workspace context class that manages routing and state for individual workflow pages
When a user clicks a workflow in the collection view, the context receives the workflow name via the route parameter, formats it as a display name, and provides it to workspace views via observables.
How it works
Section titled “How it works”Editor element
Section titled “Editor element”The editor element (up-doc-workflow-workspace-editor) consumes the workspace context to get the display name and renders the standard <umb-workspace-editor> component with it as the headline:
@customElement('up-doc-workflow-workspace-editor')class UpDocWorkflowWorkspaceEditorElement extends UmbLitElement { override render() { return html`<umb-workspace-editor headline=${this._name}></umb-workspace-editor>`; }}Workspace context
Section titled “Workspace context”The context class:
- Extends
UmbContextBaseand registers underUMB_WORKSPACE_CONTEXT - Manages an
UmbObjectState<UpDocWorkflowData>withuniqueandnamefields - Exposes
uniqueandnameas observable parts for workspace views to consume - Configures a route
edit/:uniquethat maps URL parameters toload() - Formats kebab-case workflow names to title case for display (e.g.
group-tour→Group Tour)
export class UpDocWorkflowWorkspaceContext extends UmbContextBase { public readonly workspaceAlias = 'UpDoc.WorkflowWorkspace'; readonly unique = this.#data.asObservablePart((data) => data?.unique); readonly name = this.#data.asObservablePart((data) => data?.name); readonly routes = new UmbWorkspaceRouteManager(this);}
export { UpDocWorkflowWorkspaceContext as api };The api export is required by Umbraco’s workspace manifest pattern for lazy-loaded workspace contexts.
Key concepts
Section titled “Key concepts”Routable workspace pattern
Section titled “Routable workspace pattern”Uses kind: 'routable' in the manifest, which means:
- URL routing with
edit/:uniquepath segments - Tree item selection state (if connected to a tree)
- Proper navigation between different workflow pages
Entity type
Section titled “Entity type”Returns 'updoc-workflow' from getEntityType(), matching the entityType in the workspace manifest. This connects the workspace to the correct tree items and navigation.
Name formatting
Section titled “Name formatting”Workflow folder names use kebab-case (e.g. example-group-tour). The load() method converts this to title case for the headline display.
Imports
Section titled “Imports”import { UmbWorkspaceRouteManager, UMB_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/workspace';import { UmbObjectState } from '@umbraco-cms/backoffice/observable-api';import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';Registered in
Section titled “Registered in”manifest.ts— registered as aworkspacewithkind: 'routable', aliasUpDoc.WorkflowWorkspace, entity typeupdoc-workflow
Used by
Section titled “Used by”- Workspace views (
up-doc-workflow-destination-view.element.ts,up-doc-workflow-source-views.element.ts) consume the context to get the current workflow name up-doc-workflows-view.element.tsnavigates to this workspace viahistory.pushState