Skip to content

Commit bf7efbc

Browse files
fix custom views for block list and block rte (#18565)
1 parent b9cbce5 commit bf7efbc

File tree

2 files changed

+23
-21
lines changed

2 files changed

+23
-21
lines changed

src/Umbraco.Web.UI.Client/src/packages/block/block-list/components/block-list-entry/block-list-entry.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ export class UmbBlockListEntryElement extends UmbLitElement implements UmbProper
395395
}
396396

397397
#renderBlock() {
398-
return this.contentKey
398+
return this.contentKey && (this._contentTypeAlias || this._unsupported)
399399
? html`
400400
<div class="umb-block-list__block">
401401
<umb-extension-slot

src/Umbraco.Web.UI.Client/src/packages/block/block-rte/components/block-rte-entry/block-rte-entry.element.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class UmbBlockRteEntryElement extends UmbLitElement implements UmbPropert
6666
_workspaceEditSettingsPath?: string;
6767

6868
@state()
69-
_contentElementTypeAlias?: string;
69+
_contentTypeAlias?: string;
7070

7171
@state()
7272
_contentTypeName?: string;
@@ -115,7 +115,7 @@ export class UmbBlockRteEntryElement extends UmbLitElement implements UmbPropert
115115
this.observe(
116116
this.#context.contentElementTypeAlias,
117117
(alias) => {
118-
this._contentElementTypeAlias = alias;
118+
this._contentTypeAlias = alias;
119119
},
120120
null,
121121
);
@@ -230,7 +230,7 @@ export class UmbBlockRteEntryElement extends UmbLitElement implements UmbPropert
230230
}
231231

232232
readonly #filterBlockCustomViews = (manifest: ManifestBlockEditorCustomView) => {
233-
const elementTypeAlias = this._contentElementTypeAlias ?? '';
233+
const elementTypeAlias = this._contentTypeAlias ?? '';
234234
const isForBlockEditor =
235235
!manifest.forBlockEditor || stringOrStringArrayContains(manifest.forBlockEditor, UMB_BLOCK_RTE);
236236
const isForContentTypeAlias =
@@ -256,23 +256,25 @@ export class UmbBlockRteEntryElement extends UmbLitElement implements UmbPropert
256256
};
257257

258258
#renderBlock() {
259-
return html`
260-
<div class="uui-text uui-font">
261-
<umb-extension-slot
262-
type="blockEditorCustomView"
263-
default-element="umb-ref-rte-block"
264-
.renderMethod=${this.#extensionSlotRenderMethod}
265-
.props=${this._blockViewProps}
266-
.filter=${this.#filterBlockCustomViews}
267-
single>
268-
${this.#renderRefBlock()}
269-
</umb-extension-slot>
270-
<uui-action-bar> ${this.#renderEditAction()} ${this.#renderEditSettingsAction()} </uui-action-bar>
271-
${!this._showContentEdit && this._contentInvalid
272-
? html`<uui-badge attention color="danger" label="Invalid content">!</uui-badge>`
273-
: nothing}
274-
</div>
275-
`;
259+
return this.contentKey && this._contentTypeAlias
260+
? html`
261+
<div class="uui-text uui-font">
262+
<umb-extension-slot
263+
type="blockEditorCustomView"
264+
default-element="umb-ref-rte-block"
265+
.renderMethod=${this.#extensionSlotRenderMethod}
266+
.props=${this._blockViewProps}
267+
.filter=${this.#filterBlockCustomViews}
268+
single>
269+
${this.#renderRefBlock()}
270+
</umb-extension-slot>
271+
<uui-action-bar> ${this.#renderEditAction()} ${this.#renderEditSettingsAction()} </uui-action-bar>
272+
${!this._showContentEdit && this._contentInvalid
273+
? html`<uui-badge attention color="danger" label="Invalid content">!</uui-badge>`
274+
: nothing}
275+
</div>
276+
`
277+
: nothing;
276278
}
277279

278280
#renderRefBlock() {

0 commit comments

Comments
 (0)