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

Commit f20bbee

Browse files
Merge branch 'main' into v14/feature/block-area-permissions-display-content-type-name
2 parents 786b477 + 54dcc62 commit f20bbee

File tree

31 files changed

+326
-202
lines changed

31 files changed

+326
-202
lines changed

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
"./src/packages/property-editors",
144144
"./src/packages/tags",
145145
"./src/packages/templating",
146+
"./src/packages/tiny-mce",
146147
"./src/packages/umbraco-news",
147148
"./src/packages/user",
148149
"./src/packages/webhook"

src/assets/lang/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,7 @@ export default {
15621562
ascending: 'ascending',
15631563
descending: 'descending',
15641564
template: 'Template',
1565+
systemFields: 'System fields',
15651566
},
15661567
grid: {
15671568
media: 'Image',

src/packages/block/block-grid/components/block-grid-area-config-entry/workspace/block-grid-area-type-workspace.context.ts

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { UmbArrayState, UmbObjectState, appendToFrozenArray } from '@umbraco-cms
1414
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
1515
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
1616
import type { ManifestWorkspace, PropertyEditorSettingsProperty } from '@umbraco-cms/backoffice/extension-registry';
17+
import { UmbId } from '@umbraco-cms/backoffice/id';
1718

1819
export class UmbBlockGridAreaTypeWorkspaceContext
1920
extends UmbSubmittableWorkspaceContextBase<UmbBlockGridTypeAreaType>
@@ -43,12 +44,20 @@ export class UmbBlockGridAreaTypeWorkspaceContext
4344
{
4445
path: 'edit/:id',
4546
component: () => import('./block-grid-area-type-workspace-editor.element.js'),
46-
setup: (_component, info) => {
47+
setup: (component, info) => {
4748
const id = info.match.params.id;
48-
(_component as any).workspaceAlias = manifest.alias;
49+
(component as any).workspaceAlias = manifest.alias;
4950
this.load(id);
5051
},
5152
},
53+
{
54+
path: 'create',
55+
component: () => import('./block-grid-area-type-workspace-editor.element.js'),
56+
setup: (component) => {
57+
(component as any).workspaceAlias = manifest.alias;
58+
this.create();
59+
},
60+
},
5261
]);
5362
}
5463

@@ -78,17 +87,24 @@ export class UmbBlockGridAreaTypeWorkspaceContext
7887
}
7988

8089
async create() {
81-
throw new Error('Method not implemented.');
82-
/*
83-
//Only set groupKey property if it exists
84-
const data: UmbBlockGridTypeAreaType = {
85-
90+
this.resetState();
91+
let data: UmbBlockGridTypeAreaType = {
92+
key: UmbId.new(),
93+
alias: '',
94+
columnSpan: 12,
95+
rowSpan: 1,
96+
minAllowed: 0,
97+
maxAllowed: undefined,
98+
specifiedAllowance: [],
99+
};
100+
101+
// If we have a modal context, we blend in the modal preset data: [NL]
102+
if (this.modalContext) {
103+
data = { ...data, ...this.modalContext.data.preset };
86104
}
87105

88106
this.setIsNew(true);
89107
this.#data.setValue(data);
90-
return { data };
91-
*/
92108
}
93109

94110
getData() {

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

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
66
import { html, customElement, property, state, repeat } from '@umbraco-cms/backoffice/external/lit';
77
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
88
import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property';
9-
import {
10-
UmbPropertyValueChangeEvent,
11-
type UmbPropertyEditorConfigCollection,
12-
} from '@umbraco-cms/backoffice/property-editor';
13-
import { UmbId } from '@umbraco-cms/backoffice/id';
9+
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
1410
import { UmbModalRouteRegistrationController } from '@umbraco-cms/backoffice/router';
1511
import { incrementString } from '@umbraco-cms/backoffice/utils';
1612

@@ -61,7 +57,17 @@ export class UmbPropertyEditorUIBlockGridAreasConfigElement
6157
new UmbModalRouteRegistrationController(this, UMB_BLOCK_GRID_AREA_TYPE_WORKSPACE_MODAL)
6258
.addAdditionalPath('block-grid-area-type')
6359
.onSetup(() => {
64-
return { data: { entityType: 'block-grid-area-type', preset: {} }, modal: { size: 'large' } };
60+
if (!this._areaGridColumns) return false;
61+
const halfGridColumns = this._areaGridColumns * 0.5;
62+
const columnSpan = halfGridColumns === Math.round(halfGridColumns) ? halfGridColumns : this._areaGridColumns;
63+
64+
return {
65+
data: {
66+
entityType: 'block-grid-area-type',
67+
preset: { columnSpan, alias: this.#generateUniqueAreaAlias('area') },
68+
},
69+
modal: { size: 'large' },
70+
};
6571
})
6672
.observeRouteBuilder((routeBuilder) => {
6773
this._workspacePath = routeBuilder({});
@@ -104,29 +110,6 @@ export class UmbPropertyEditorUIBlockGridAreasConfigElement
104110
return alias;
105111
}
106112

107-
#addNewArea() {
108-
if (!this._areaGridColumns) return;
109-
const halfGridColumns = this._areaGridColumns * 0.5;
110-
const columnSpan = halfGridColumns === Math.round(halfGridColumns) ? halfGridColumns : this._areaGridColumns;
111-
112-
this._value = [
113-
...this._value,
114-
{
115-
key: UmbId.new(),
116-
alias: this.#generateUniqueAreaAlias('area'),
117-
columnSpan: columnSpan,
118-
rowSpan: 1,
119-
minAllowed: 0,
120-
maxAllowed: undefined,
121-
specifiedAllowance: [],
122-
},
123-
];
124-
this.requestUpdate('_value');
125-
this.dispatchEvent(new UmbPropertyValueChangeEvent());
126-
127-
//TODO: open area edit workspace
128-
}
129-
130113
override render() {
131114
return this._areaGridColumns
132115
? html`${this._styleElement}
@@ -144,7 +127,11 @@ export class UmbPropertyEditorUIBlockGridAreasConfigElement
144127
.key=${area.key}></umb-block-area-config-entry>`,
145128
)}
146129
</div>
147-
<uui-button id="add-button" look="placeholder" label=${'Add area'} @click=${this.#addNewArea}></uui-button>`
130+
<uui-button
131+
id="add-button"
132+
look="placeholder"
133+
label=${'Add area'}
134+
href=${this._workspacePath + 'create'}></uui-button>`
148135
: '';
149136
}
150137
}

src/packages/block/block-type/workspace/block-type-workspace.context.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
112112

113113
this.setIsNew(true);
114114
this.#data.setValue(data);
115-
return { data };
116115
}
117116

118117
getData() {

src/packages/core/components/input-entity/input-entity.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class UmbInputEntityElement extends UmbFormControlMixin<string | undefine
148148
id="btn-add"
149149
look="placeholder"
150150
@click=${this.#openPicker}
151-
label="${this.localize.term('general_choose')}"></uui-button>
151+
label=${this.localize.term('general_choose')}></uui-button>
152152
`;
153153
}
154154

src/packages/core/content-type/modals/composition-picker/composition-picker-modal.element.ts

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,22 @@ export class UmbCompositionPickerModalElement extends UmbModalBaseElement<
130130
<div slot="actions">
131131
<uui-button label=${this.localize.term('general_close')} @click=${this._rejectModal}></uui-button>
132132
${!this._references.length
133-
? html`<uui-button
134-
label=${this.localize.term('general_submit')}
135-
look="primary"
136-
color="positive"
137-
@click=${this._submitModal}></uui-button>`
133+
? html`
134+
<uui-button
135+
label=${this.localize.term('general_submit')}
136+
look="primary"
137+
color="positive"
138+
@click=${this._submitModal}></uui-button>
139+
`
138140
: nothing}
139141
</div>
140142
</umb-body-layout>
141143
`;
142144
}
143145

144146
#renderHasReference() {
145-
return html` <umb-localize key="contentTypeEditor_compositionInUse">
147+
return html`
148+
<umb-localize key="contentTypeEditor_compositionInUse">
146149
This Content Type is used in a composition, and therefore cannot be composed itself.
147150
</umb-localize>
148151
<h4>
@@ -155,19 +158,22 @@ export class UmbCompositionPickerModalElement extends UmbModalBaseElement<
155158
${repeat(
156159
this._references,
157160
(item) => item.unique,
158-
(item) =>
159-
html`<uui-ref-node-document-type
161+
(item) => html`
162+
<uui-ref-node-document-type
160163
href=${'/section/settings/workspace/document-type/edit/' + item.unique}
161-
name=${item.name}>
164+
name=${this.localize.string(item.name)}>
162165
<umb-icon slot="icon" name=${item.icon}></umb-icon>
163-
</uui-ref-node-document-type>`,
166+
</uui-ref-node-document-type>
167+
`,
164168
)}
165-
</div>`;
169+
</div>
170+
`;
166171
}
167172

168173
#renderAvailableCompositions() {
169174
if (this._compatibleCompositions) {
170-
return html`<umb-localize key="contentTypeEditor_compositionsDescription">
175+
return html`
176+
<umb-localize key="contentTypeEditor_compositionsDescription">
171177
Inherit tabs and properties from an existing Document Type. New tabs will be<br />added to the current
172178
Document Type or merged if a tab with an identical name exists.<br />
173179
</umb-localize>
@@ -185,27 +191,31 @@ export class UmbCompositionPickerModalElement extends UmbModalBaseElement<
185191
: nothing}
186192
${this.#renderCompositionsItems(folder.compositions)}`,
187193
)}
188-
</div>`;
194+
</div>
195+
`;
189196
} else {
190-
return html`<umb-localize key="contentTypeEditor_noAvailableCompositions">
191-
There are no Content Types available to use as a composition
192-
</umb-localize>`;
197+
return html`
198+
<umb-localize key="contentTypeEditor_noAvailableCompositions">
199+
There are no Content Types available to use as a composition
200+
</umb-localize>
201+
`;
193202
}
194203
}
195204

196205
#renderCompositionsItems(compositionsList: Array<UmbContentTypeCompositionCompatibleModel>) {
197206
return repeat(
198207
compositionsList,
199208
(compositions) => compositions.unique,
200-
(compositions) =>
201-
html`<uui-menu-item
202-
label=${compositions.name}
209+
(compositions) => html`
210+
<uui-menu-item
211+
label=${this.localize.string(compositions.name)}
203212
selectable
204213
@selected=${() => this.#onSelectionAdd(compositions.unique)}
205214
@deselected=${() => this.#onSelectionRemove(compositions.unique)}
206215
?selected=${this._selection.find((unique) => unique === compositions.unique)}>
207216
<umb-icon name=${compositions.icon} slot="icon"></umb-icon>
208-
</uui-menu-item>`,
217+
</uui-menu-item>
218+
`,
209219
);
210220
}
211221

src/packages/core/content-type/structure/content-type-container-structure-helper.class.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { UmbContentTypeModel, UmbPropertyContainerTypes, UmbPropertyTypeContainerModel } from '../types.js';
22
import type { UmbContentTypeStructureManager } from './content-type-structure-manager.class.js';
33
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
4-
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
4+
import type { UmbController, UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
55
import { UmbArrayState } from '@umbraco-cms/backoffice/observable-api';
66

77
/**
@@ -17,6 +17,8 @@ export class UmbContentTypeContainerStructureHelper<T extends UmbContentTypeMode
1717

1818
#structure?: UmbContentTypeStructureManager<T>;
1919

20+
#containerObservers: Array<UmbController> = [];
21+
2022
// State containing the all containers defined in the data:
2123
#childContainers = new UmbArrayState<UmbPropertyTypeContainerModel>([], (x) => x.id);
2224
readonly containers = this.#childContainers.asObservable();
@@ -150,30 +152,31 @@ export class UmbContentTypeContainerStructureHelper<T extends UmbContentTypeMode
150152
this.#parentType,
151153
),
152154
(containers) => {
153-
// We want to remove hasProperties of groups that does not exist anymore.:
154-
// this.#removeHasPropertiesOfGroup()
155155
this.#hasProperties.setValue([]);
156156
this.#childContainers.setValue([]);
157+
this.#containerObservers.forEach((x) => x.destroy());
158+
this.#containerObservers = [];
157159

158160
containers.forEach((container) => {
159161
this.#observeHasPropertiesOf(container.id);
160162

161-
this.observe(
162-
this.#structure!.containersOfParentId(container.id, this.#childType!),
163-
(containers) => {
164-
// get the direct owner containers of this container id:
165-
this.#ownerChildContainers =
166-
this.#structure!.getOwnerContainers(this.#childType!, this.#containerId!) ?? [];
167-
// TODO: Maybe check for dif before setting it? Cause currently we are setting it every time one of the containers change. [NL]
168-
169-
// Remove existing containers that are not the parent of the new containers:
170-
this.#childContainers.filter(
171-
(x) => x.parent?.id !== container.id || containers.some((y) => y.id === x.id),
172-
);
173-
174-
this.#childContainers.append(containers);
175-
},
176-
'_observeGroupsOf_' + container.id,
163+
this.#containerObservers.push(
164+
this.observe(
165+
this.#structure!.containersOfParentId(container.id, this.#childType!),
166+
(containers) => {
167+
// get the direct owner containers of this container id: [NL]
168+
this.#ownerChildContainers =
169+
this.#structure!.getOwnerContainers(this.#childType!, this.#containerId!) ?? [];
170+
171+
// Remove existing containers that are not the parent of the new containers: [NL]
172+
this.#childContainers.filter(
173+
(x) => x.parent?.id !== container.id || containers.some((y) => y.id === x.id),
174+
);
175+
176+
this.#childContainers.append(containers);
177+
},
178+
'_observeGroupsOf_' + container.id,
179+
),
177180
);
178181
});
179182
},

0 commit comments

Comments
 (0)