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

Commit efdc560

Browse files
committed
manifest viewer modal
1 parent 87f867c commit efdc560

File tree

12 files changed

+90
-14
lines changed

12 files changed

+90
-14
lines changed

src/assets/lang/en-us.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,7 @@ export default {
820820
logout: 'Logout',
821821
macro: 'Macro',
822822
mandatory: 'Mandatory',
823+
manifest: 'Manifest',
823824
media: 'Media',
824825
message: 'Message',
825826
move: 'Move',

src/assets/lang/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ export default {
831831
logout: 'Logout',
832832
macro: 'Macro',
833833
mandatory: 'Mandatory',
834+
manifest: 'Manifest',
834835
message: 'Message',
835836
move: 'Move',
836837
name: 'Name',

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
22
import { html, customElement, state, property, repeat } from '@umbraco-cms/backoffice/external/lit';
33
import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property';
4-
import { umbExtensionsRegistry, type ManifestBlockEditorCustomView } from '@umbraco-cms/backoffice/extension-registry';
4+
import {
5+
UMB_MANIFEST_VIEWER_MODAL,
6+
umbExtensionsRegistry,
7+
type ManifestBlockEditorCustomView,
8+
} from '@umbraco-cms/backoffice/extension-registry';
59
import { stringOrStringArrayContains } from '@umbraco-cms/backoffice/utils';
610
import { UmbExtensionsManifestInitializer } from '@umbraco-cms/backoffice/extension-api';
711
import { UmbDocumentTypeDetailRepository } from '@umbraco-cms/backoffice/document-type';
12+
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
813

914
@customElement('umb-block-type-custom-view-guide')
1015
export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement {
@@ -77,13 +82,20 @@ export class UmbBlockTypeCustomViewGuideElement extends UmbLitElement {
7782
return true;
7883
};
7984

85+
async #viewManifest(manifest: ManifestBlockEditorCustomView) {
86+
const modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);
87+
modalManager.open(this, UMB_MANIFEST_VIEWER_MODAL, { data: manifest });
88+
}
89+
8090
override render() {
8191
return this._manifests && this._manifests.length > 0
8292
? html` <div>
8393
${repeat(
8494
this._manifests,
8595
(x) => x.alias,
86-
(x) => html` <umb-ref-manifest standalone .manifest=${x}></umb-ref-manifest> `,
96+
(x) => html`
97+
<umb-ref-manifest standalone @open=${() => this.#viewManifest(x)} .manifest=${x}></umb-ref-manifest>
98+
`,
8799
)}
88100
</div>`
89101
: html`No custom view matches the current block editor type and content type.`;
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export * from './composition-picker-modal.element.js';
21
export * from './composition-picker-modal.token.js';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { ManifestModal } from '@umbraco-cms/backoffice/extension-registry';
2+
3+
export const manifest: ManifestModal = {
4+
type: 'modal',
5+
alias: 'Umb.Modal.CompositionPicker',
6+
name: 'ContentType Composition Picker Modal',
7+
element: () => import('./composition-picker-modal.element.js'),
8+
};
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
import type { ManifestModal } from '@umbraco-cms/backoffice/extension-registry';
1+
import { manifest } from './composition-picker/manifest.js';
22

3-
const modals: Array<ManifestModal> = [
4-
{
5-
type: 'modal',
6-
alias: 'Umb.Modal.CompositionPicker',
7-
name: 'ContentType Composition Picker Modal',
8-
element: () => import('./composition-picker/composition-picker-modal.element.js'),
9-
},
10-
];
11-
12-
export const manifests = modals;
3+
export const manifests = [manifest];

src/packages/core/extension-registry/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from './conditions/index.js';
22
export * from './initializers/index.js';
3+
export * from './modals/manifest-viewer/index.js';
34
export * from './registry.js';
45
export * from './utils/index.js';
56
export type * from './interfaces/index.js';

src/packages/core/extension-registry/manifests.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { manifests as menuItemManifests } from './menu-item/manifests.js';
33
import { manifests as workspaceManifests } from './workspace/manifests.js';
44
import { manifests as collectionManifests } from './collection/manifests.js';
55
import { manifests as entityActionManifests } from './entity-actions/manifests.js';
6+
import { manifest as modalManifest } from './modals/manifest-viewer/manifest.js';
67
import type { ManifestTypes } from './models/index.js';
78

89
export const manifests: Array<ManifestTypes> = [
@@ -11,4 +12,5 @@ export const manifests: Array<ManifestTypes> = [
1112
...workspaceManifests,
1213
...collectionManifests,
1314
...entityActionManifests,
15+
modalManifest,
1416
];
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './manifest-viewer-modal.token.js';
2+
export * from './manifest.js';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { UmbManifestViewerModalData, UmbManifestViewerModalValue } from './manifest-viewer-modal.token.js';
2+
import { css, html, customElement, nothing } from '@umbraco-cms/backoffice/external/lit';
3+
import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal';
4+
5+
@customElement('umb-manifest-viewer-modal')
6+
export class UmbManifestViewerModalElement extends UmbModalBaseElement<
7+
UmbManifestViewerModalData,
8+
UmbManifestViewerModalValue
9+
> {
10+
override render() {
11+
console.log('data', this.data);
12+
return html`
13+
<umb-body-layout headline="${this.localize.term('general_manifest')}" main-no-padding>
14+
${this.data
15+
? html`<umb-code-block language="json" copy style="height:100%; border: none;"
16+
>${JSON.stringify(this.data, null, 2)}</umb-code-block
17+
>`
18+
: nothing}
19+
<div slot="actions">
20+
<uui-button label=${this.localize.term('general_close')} @click=${this._rejectModal}></uui-button>
21+
</div>
22+
</umb-body-layout>
23+
`;
24+
}
25+
26+
static override styles = [css``];
27+
}
28+
29+
export default UmbManifestViewerModalElement;
30+
31+
declare global {
32+
interface HTMLElementTagNameMap {
33+
'umb-manifest-viewer-modal': UmbManifestViewerModalElement;
34+
}
35+
}

0 commit comments

Comments
 (0)