diff --git a/src/packages/block/block/workspace/block-workspace-editor.element.ts b/src/packages/block/block/workspace/block-workspace-editor.element.ts index 1049dc8d24..7a94de0272 100644 --- a/src/packages/block/block/workspace/block-workspace-editor.element.ts +++ b/src/packages/block/block/workspace/block-workspace-editor.element.ts @@ -4,13 +4,16 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'; @customElement('umb-block-workspace-editor') export class UmbBlockWorkspaceEditorElement extends UmbLitElement { - // + @property({ type: String, attribute: false }) workspaceAlias?: string; + @property({ type: String, attribute: false }) + label?: string; + render() { - return this.workspaceAlias - ? html` ` + return this.workspaceAlias && this.label + ? html` ` : ''; } diff --git a/src/packages/block/block/workspace/block-workspace.context.ts b/src/packages/block/block/workspace/block-workspace.context.ts index 867bfb06d2..85f984e046 100644 --- a/src/packages/block/block/workspace/block-workspace.context.ts +++ b/src/packages/block/block/workspace/block-workspace.context.ts @@ -94,25 +94,30 @@ export class UmbBlockWorkspaceContext { - (component as UmbBlockWorkspaceEditorElement).workspaceAlias = manifest.alias; - const elementTypeKey = info.match.params.elementTypeKey; - this.create(elementTypeKey); + await this.create(elementTypeKey); new UmbWorkspaceIsNewRedirectController( this, this, this.getHostElement().shadowRoot!.querySelector('umb-router-slot')!, ); + + (component as UmbBlockWorkspaceEditorElement).workspaceAlias = manifest.alias; + const name = this.getName(); + (component as UmbBlockWorkspaceEditorElement).label = name; }, }, { path: 'edit/:udi', component: UmbBlockWorkspaceEditorElement, - setup: (component, info) => { - (component as UmbBlockWorkspaceEditorElement).workspaceAlias = manifest.alias; + setup: async (component, info) => { const udi = decodeFilePath(info.match.params.udi); - this.load(udi); + await this.load(udi); + + (component as UmbBlockWorkspaceEditorElement).workspaceAlias = manifest.alias; + const name = this.getName(); + (component as UmbBlockWorkspaceEditorElement).label = name; }, }, ]); @@ -147,7 +152,13 @@ export class UmbBlockWorkspaceContext { - this.content.setData(contentData); + if (contentData) { + this.content.setData(contentData); + const blockType = this.#blockManager!.getBlockTypeOf(contentData.contentTypeKey); + if (blockType?.label) { + this.setName(blockType.label); + } + } }, 'observeContent', ); @@ -218,6 +229,11 @@ export class UmbBlockWorkspaceContext