parse config to block list elements

This commit is contained in:
Niels Lyngsø
2024-10-11 13:23:14 +02:00
parent b93914a489
commit d6c6eddb3c
2 changed files with 6 additions and 19 deletions

View File

@@ -267,6 +267,7 @@ export class UmbBlockListEntryElement extends UmbLitElement implements UmbProper
.label=${this._label}
.icon=${this._icon}
.unpublished=${!this._exposed}
.config=${this._blockViewProps.config}
.content=${this._blockViewProps.content}
.settings=${this._blockViewProps.settings}></umb-ref-list-block>`;
}
@@ -276,6 +277,7 @@ export class UmbBlockListEntryElement extends UmbLitElement implements UmbProper
.label=${this._label}
.icon=${this._icon}
.unpublished=${!this._exposed}
.config=${this._blockViewProps.config}
.content=${this._blockViewProps.content}
.settings=${this._blockViewProps.settings}></umb-inline-list-block>`;
}

View File

@@ -1,9 +1,9 @@
import { css, customElement, html, property } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UMB_BLOCK_ENTRY_CONTEXT } from '@umbraco-cms/backoffice/block';
import type { UmbBlockDataType } from '@umbraco-cms/backoffice/block';
import '@umbraco-cms/backoffice/ufm';
import type { UmbBlockEditorCustomViewConfiguration } from '@umbraco-cms/backoffice/block-custom-view';
/**
* @element umb-ref-list-block
@@ -23,27 +23,12 @@ export class UmbRefListBlockElement extends UmbLitElement {
@property({ attribute: false })
content?: UmbBlockDataType;
@property()
_workspaceEditPath?: string;
constructor() {
super();
// UMB_BLOCK_LIST_ENTRY_CONTEXT
this.consumeContext(UMB_BLOCK_ENTRY_CONTEXT, async (context) => {
this.observe(
context.workspaceEditContentPath,
(workspaceEditPath) => {
this._workspaceEditPath = workspaceEditPath;
},
'observeWorkspaceEditPath',
);
});
}
@property({ attribute: false })
config?: UmbBlockEditorCustomViewConfiguration;
override render() {
return html`
<uui-ref-node standalone href=${this._workspaceEditPath ?? '#'}>
href=${(this.config?.showContentEdit ? this.config?.editContentPath : undefined) ?? ''}>
<umb-icon slot="icon" .name=${this.icon}></umb-icon>
<umb-ufm-render slot="name" inline .markdown=${this.label} .value=${this.content}></umb-ufm-render>
</uui-ref-node>