Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit efddd28

Browse files
committed
generator
1 parent efdc560 commit efddd28

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

src/packages/block/block-grid/components/block-grid-entries/block-grid-entries.element.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ export class UmbBlockGridEntriesElement extends UmbFormControlMixin(UmbLitElemen
291291
if (this._areaKey === null || this._layoutEntries.length === 0) {
292292
return html`<uui-button-group>
293293
<uui-button
294-
id="add-button"
295294
look="placeholder"
296295
label=${this._singleBlockTypeName
297296
? this.localize.term('blockEditor_addThis', [this._singleBlockTypeName])

src/packages/block/block-grid/property-editors/block-grid-areas-config/property-editor-ui-block-grid-areas-config.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export class UmbPropertyEditorUIBlockGridAreasConfigElement
144144
.key=${area.key}></umb-block-area-config-entry>`,
145145
)}
146146
</div>
147-
<uui-button id="add-button" look="placeholder" label=${'Add area'} @click=${this.#addNewArea}></uui-button>`
147+
<uui-button look="placeholder" label=${'Add area'} @click=${this.#addNewArea}></uui-button>`
148148
: '';
149149
}
150150
}

src/packages/block/block-list/property-editors/block-list-editor/property-editor-ui-block-list.element.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,7 @@ export class UmbPropertyEditorUIBlockListElement extends UmbLitElement implement
175175
</umb-block-list-entry> `,
176176
)}
177177
<uui-button-group>
178-
<uui-button
179-
id="add-button"
180-
look="placeholder"
181-
label=${this._createButtonLabel}
182-
href=${createPath ?? ''}></uui-button>
178+
<uui-button look="placeholder" label=${this._createButtonLabel} href=${createPath ?? ''}></uui-button>
183179
<uui-button
184180
label=${this.localize.term('content_createFromClipboard')}
185181
look="placeholder"

src/packages/block/block-type/components/block-type-custom-view-guide/block-type-custom-view-guide.element.ts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2-
import { html, customElement, state, property, repeat } from '@umbraco-cms/backoffice/external/lit';
2+
import { html, customElement, state, property, repeat, css } from '@umbraco-cms/backoffice/external/lit';
33
import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property';
44
import {
55
UMB_MANIFEST_VIEWER_MODAL,
@@ -13,6 +13,7 @@ import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
1313

1414
@customElement('umb-block-type-custom-view-guide')
1515
export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement {
16+
#contentTypeName?: string;
1617
#contentTypeAlias?: string;
1718
#blockEditorType?: string;
1819

@@ -42,6 +43,7 @@ export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement {
4243
this.observe(
4344
asObservable(),
4445
(model) => {
46+
this.#contentTypeName = model?.name;
4547
this.#contentTypeAlias = model?.alias;
4648
this.#loadManifests();
4749
},
@@ -54,7 +56,6 @@ export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement {
5456
}
5557

5658
#loadManifests() {
57-
console.log('this.#blockEditorType', this.#blockEditorType, 'this.#contentTypeAlias', this.#contentTypeAlias);
5859
if (!this.#blockEditorType || !this.#contentTypeAlias) return;
5960
new UmbExtensionsManifestInitializer(
6061
this,
@@ -87,6 +88,20 @@ export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement {
8788
modalManager.open(this, UMB_MANIFEST_VIEWER_MODAL, { data: manifest });
8889
}
8990

91+
async #generateManifest() {
92+
const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
93+
94+
const manifest = {
95+
type: 'blockEditorCustomView',
96+
alias: 'Local.blockEditorCustomView.' + this.#contentTypeAlias,
97+
name: 'Block Editor Custom View for ' + this.#contentTypeName,
98+
element: '[replace with path to your web component js file...]',
99+
forContentTypeAlias: this.#contentTypeAlias,
100+
forBlockEditor: this.#blockEditorType,
101+
};
102+
modalManager.open(this, UMB_MANIFEST_VIEWER_MODAL, { data: manifest });
103+
}
104+
90105
override render() {
91106
return this._manifests && this._manifests.length > 0
92107
? html` <div>
@@ -98,8 +113,23 @@ export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement {
98113
`,
99114
)}
100115
</div>`
101-
: html`No custom view matches the current block editor type and content type.`;
116+
: html`<uui-button
117+
id="add-button"
118+
look="placeholder"
119+
label="Generate manifest for this Block Type"
120+
type="button"
121+
color="default"
122+
@click=${() => this.#generateManifest()}></uui-button>`;
102123
}
124+
125+
static override styles = [
126+
css`
127+
#add-button {
128+
text-align: center;
129+
width: 100%;
130+
}
131+
`,
132+
];
103133
}
104134

105135
export default UmbBlockTypeCustomViewGuideElement;

src/packages/core/extension-registry/modals/manifest-viewer/manifest-viewer-modal.element.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@ import type { UmbManifestViewerModalData, UmbManifestViewerModalValue } from './
22
import { css, html, customElement, nothing } from '@umbraco-cms/backoffice/external/lit';
33
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
44

5+
// JSON parser for the manifest viewer modal
6+
// Enabling us to view JS code, but it is not optimal, but currently better than nothing [NL]
7+
// Ideally we should have a JS code stringify that can print the manifest as JS. [NL]
8+
function JsonParser(key: string, value: any) {
9+
if (typeof value === 'function' && value !== null && value.toString) {
10+
return Function.prototype.toString.call(value);
11+
}
12+
return value;
13+
}
14+
515
@customElement('umb-manifest-viewer-modal')
616
export class UmbManifestViewerModalElement extends UmbModalBaseElement<
717
UmbManifestViewerModalData,
818
UmbManifestViewerModalValue
919
> {
1020
override render() {
11-
console.log('data', this.data);
1221
return html`
1322
<umb-body-layout headline="${this.localize.term('general_manifest')}" main-no-padding>
1423
${this.data
1524
? html`<umb-code-block language="json" copy style="height:100%; border: none;"
16-
>${JSON.stringify(this.data, null, 2)}</umb-code-block
25+
>${JSON.stringify(this.data, JsonParser, 2)}</umb-code-block
1726
>`
1827
: nothing}
1928
<div slot="actions">

0 commit comments

Comments
 (0)