disable create/paste buttons instead of removing them
This commit is contained in:
@@ -265,7 +265,8 @@ export class UmbPropertyEditorUIBlockListElement
|
||||
}
|
||||
|
||||
override render() {
|
||||
return html` ${repeat(
|
||||
return html`
|
||||
${repeat(
|
||||
this._layouts,
|
||||
(x) => x.contentKey,
|
||||
(layoutEntry, index) => html`
|
||||
@@ -278,7 +279,16 @@ export class UmbPropertyEditorUIBlockListElement
|
||||
</umb-block-list-entry>
|
||||
`,
|
||||
)}
|
||||
<uui-button-group> ${this.#renderCreateButton()} ${this.#renderPasteButton()} </uui-button-group>`;
|
||||
${this.#renderCreateButtonGroup()}
|
||||
`;
|
||||
}
|
||||
|
||||
#renderCreateButtonGroup() {
|
||||
if (this.readonly && this._layouts.length > 0) {
|
||||
return nothing;
|
||||
} else {
|
||||
return html` <uui-button-group> ${this.#renderCreateButton()} ${this.#renderPasteButton()} </uui-button-group> `;
|
||||
}
|
||||
}
|
||||
|
||||
#renderInlineCreateButton(index: number) {
|
||||
@@ -289,8 +299,6 @@ export class UmbPropertyEditorUIBlockListElement
|
||||
}
|
||||
|
||||
#renderCreateButton() {
|
||||
if (this.readonly) return nothing;
|
||||
|
||||
let createPath: string | undefined;
|
||||
if (this._blocks?.length === 1) {
|
||||
const elementKey = this._blocks[0].contentElementTypeKey;
|
||||
@@ -301,17 +309,21 @@ export class UmbPropertyEditorUIBlockListElement
|
||||
}
|
||||
|
||||
return html`
|
||||
<uui-button look="placeholder" label=${this._createButtonLabel} href=${createPath ?? ''}></uui-button>
|
||||
<uui-button
|
||||
look="placeholder"
|
||||
label=${this._createButtonLabel}
|
||||
href=${createPath ?? ''}
|
||||
?disabled=${this.readonly}></uui-button>
|
||||
`;
|
||||
}
|
||||
|
||||
#renderPasteButton() {
|
||||
if (this.readonly) return nothing;
|
||||
return html`
|
||||
<uui-button
|
||||
label=${this.localize.term('content_createFromClipboard')}
|
||||
look="placeholder"
|
||||
href=${this._catalogueRouteBuilder?.({ view: 'clipboard', index: -1 }) ?? ''}>
|
||||
href=${this._catalogueRouteBuilder?.({ view: 'clipboard', index: -1 }) ?? ''}
|
||||
?disabled=${this.readonly}>
|
||||
<uui-icon name="icon-paste-in"></uui-icon>
|
||||
</uui-button>
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user