up-doc-workspace.context.ts
Workspace context for the UpDoc Settings section entry.
What it does
Section titled “What it does”Provides the workspace context Umbraco expects when a tree item is opened, and registers the route that renders it. This is the section workspace — distinct from up-doc-workflow-workspace.context.ts, which handles individual workflows.
Editor element
Section titled “Editor element”Declared in the same file, a thin wrapper around Umbraco’s workspace editor:
@customElement('up-doc-workspace-editor')class UpDocWorkspaceEditorElement extends LitElement { override render() { return html`<umb-workspace-editor></umb-workspace-editor>`; }}umb-workspace-editor supplies the chrome — header, tabs, action bar. Tabs themselves come from views registered in manifest.ts (About, Workflows, Configuration).
Context class
Section titled “Context class”export class UpDocWorkspaceContext extends UmbContextBase { public readonly workspaceAlias = 'UpDoc.Workspace';
#data = new UmbObjectState<UpDocWorkspaceData | undefined>(undefined); readonly data = this.#data.asObservable(); readonly unique = this.#data.asObservablePart((data) => data?.unique); readonly name = this.#data.asObservablePart((data) => data?.name);
readonly routes = new UmbWorkspaceRouteManager(this);}State is held in an UmbObjectState with two derived observable parts, following the standard Umbraco state pattern. Views consume the context and observe unique or name rather than reading state directly.
Routing
Section titled “Routing”One route, registered in the constructor:
this.routes.setRoutes([ { path: 'edit/:unique', component: UpDocWorkspaceEditorElement, setup: (_component, info) => { const unique = info.match.params.unique; this.load(unique); }, },]);load() sets the unique and a fixed name of “UpDoc”. There is no server call — the section has a single entry and nothing to fetch.
Cleanup
Section titled “Cleanup”destroy() disposes the state object before delegating to the base class. Omitting that leaks the observable.
Used by
Section titled “Used by”manifest.ts— registers the workspace and its viewsup-doc-tree.repository.ts— suppliesUPDOC_ENTITY_TYPE, returned bygetEntityType()
See also
Section titled “See also”up-doc-workflow-workspace.context.ts— the per-workflow workspace, which is where the real work happens