Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
<umb-extension-slot
.filter=${this.#extensionSlotFilterMethod}
.renderMethod=${this.#extensionSlotRenderMethod}
.defaultRenderMethod=${this.#renderBuiltinBlockView}
.fallbackRenderMethod=${this.#renderBuiltinBlockView}
.props=${this._blockViewProps}
default-element=${this._inlineEditingMode ? 'umb-block-grid-block-inline' : 'umb-block-grid-block'}
type="blockEditorCustomView"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,15 @@ export class UmbBlockListEntryElement extends UmbLitElement implements UmbProper
${umbDestroyOnDisconnect()}></umb-unsupported-list-block>`;
}

#renderBuiltinBlockView() {
#renderBuiltinBlockView = () => {
if (this._unsupported) {
return this.#renderUnsupportedBlock();
}
if (this._inlineEditingMode) {
return this.#renderInlineBlock();
}
return this.#renderRefBlock();
}
};

#renderBlock() {
return this.contentKey && (this._contentTypeAlias || this._unsupported)
Expand All @@ -417,11 +417,10 @@ export class UmbBlockListEntryElement extends UmbLitElement implements UmbProper
type="blockEditorCustomView"
default-element=${this._inlineEditingMode ? 'umb-inline-list-block' : 'umb-ref-list-block'}
.renderMethod=${this.#extensionSlotRenderMethod}
.fallbackRenderMethod=${this.#renderBuiltinBlockView}
.props=${this._blockViewProps}
.filter=${this.#extensionSlotFilterMethod}
single
>${this.#renderBuiltinBlockView()}</umb-extension-slot
>
single></umb-extension-slot>
${this.#renderActionBar()}
${!this._showContentEdit && this._contentInvalid
? html`<uui-badge attention color="invalid" label="Invalid content">!</uui-badge>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,10 @@ export class UmbBlockRteEntryElement extends UmbLitElement implements UmbPropert
type="blockEditorCustomView"
default-element="umb-ref-rte-block"
.renderMethod=${this.#extensionSlotRenderMethod}
.fallbackRenderMethod=${this.#renderBuiltinBlockView}
.props=${this._blockViewProps}
.filter=${this.#filterBlockCustomViews}
single>
${this.#renderRefBlock()}
</umb-extension-slot>
single></umb-extension-slot>
${this.#renderActionBar()}
${!this._showContentEdit && this._contentInvalid
? html`<uui-badge attention color="invalid" label="Invalid content">!</uui-badge>`
Expand All @@ -297,6 +296,14 @@ export class UmbBlockRteEntryElement extends UmbLitElement implements UmbPropert
: nothing;
}

#renderBuiltinBlockView = () => {
// TODO: Missing unsupported rendering [NL]
/*if (this._unsupported) {
return this.#renderUnsupportedBlock();
}*/
return this.#renderRefBlock();
};

#renderRefBlock() {
return html`<umb-ref-rte-block
.label=${this._label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class UmbExtensionSlotElement extends UmbLitElement {
) => TemplateResult | TemplateResult<1> | HTMLElement | null | undefined | typeof nothing;

@property({ attribute: false })
public defaultRenderMethod?: () =>
public fallbackRenderMethod?: () =>
| TemplateResult
| TemplateResult<1>
| HTMLElement
Expand Down Expand Up @@ -142,15 +142,18 @@ export class UmbExtensionSlotElement extends UmbLitElement {
}

override render() {
// First renders something once _permitted is set, this is to avoid flickering. [NL]
return this._permitted
? this._permitted.length > 0
? repeat(this._permitted, (ext) => ext.alias, this.#renderExtension)
: this.defaultRenderMethod
? this.defaultRenderMethod()
: html`<slot></slot>`
: this.#renderNoting()
: nothing;
}

#renderNoting() {
return this.fallbackRenderMethod ? this.fallbackRenderMethod() : html`<slot></slot>`;
}

#renderExtension = (ext: UmbExtensionElementInitializer, i: number) => {
return this.renderMethod ? this.renderMethod(ext, i) : ext.component;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ export class UmbExtensionWithApiSlotElement extends UmbLitElement {
index: number,
) => TemplateResult | TemplateResult<1> | HTMLElement | null | undefined | typeof nothing;

@property({ attribute: false })
public fallbackRenderMethod?: () =>
| TemplateResult
| TemplateResult<1>
| HTMLElement
| null
| undefined
| typeof nothing;

override connectedCallback(): void {
super.connectedCallback();
this.#attached = true;
Expand Down Expand Up @@ -185,10 +194,14 @@ export class UmbExtensionWithApiSlotElement extends UmbLitElement {
return this._permitted
? this._permitted.length > 0
? repeat(this._permitted, (ext) => ext.alias, this.#renderExtension)
: html`<slot></slot>`
: this.#renderNoting()
: nothing;
}

#renderNoting() {
return this.fallbackRenderMethod ? this.fallbackRenderMethod() : html`<slot></slot>`;
}

#renderExtension = (ext: UmbExtensionElementAndApiInitializer, i: number) => {
return this.renderMethod ? this.renderMethod(ext, i) : ext.component;
};
Expand Down
Loading