Skip to content

Commit 8d3951d

Browse files
Finish of v4.0.0
1 parent d4d41bf commit 8d3951d

28 files changed

+2085
-1658
lines changed

src/Umbraco.Cms.16.x/Properties/launchSettings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"windowsAuthentication": false,
55
"anonymousAuthentication": true,
66
"iisExpress": {
7-
"applicationUrl": "http://localhost:26292",
8-
"sslPort": 44368
7+
"applicationUrl": "http://localhost:26293",
8+
"sslPort": 44369
99
}
1010
},
1111
"profiles": {
@@ -20,7 +20,7 @@
2020
"commandName": "Project",
2121
"dotnetRunMessages": true,
2222
"launchBrowser": true,
23-
"applicationUrl": "https://localhost:44368;http://localhost:26292",
23+
"applicationUrl": "https://localhost:44369;http://localhost:26293",
2424
"environmentVariables": {
2525
"ASPNETCORE_ENVIRONMENT": "Development"
2626
}

src/Umbraco.Cms.16.x/Umbraco.Cms.16.x.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Umbraco.Cms" Version="16.0.0-rc5" />
11-
<PackageReference Include="Umbraco.Cms.Core" Version="16.0.0-rc5" />
12-
<PackageReference Include="Umbraco.Cms.StaticAssets" Version="16.0.0-rc5" />
13-
<PackageReference Include="uSync" Version="16.0.0-rc2" />
10+
<PackageReference Include="Umbraco.Cms" Version="16.0.0" />
11+
<PackageReference Include="Umbraco.Cms.Core" Version="16.0.0" />
12+
<PackageReference Include="Umbraco.Cms.StaticAssets" Version="16.0.0" />
13+
<PackageReference Include="uSync" Version="16.0.0" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

src/Umbraco.Cms.16.x/Views/Partials/blockgrid/items.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<div class="umb-block-grid__layout-item"
1111
data-content-element-type-alias="@item.Content.ContentType.Alias"
1212
data-content-element-type-key="@item.Content.ContentType.Key"
13-
data-element-udi="@item.ContentUdi"
13+
data-element-udi="@item.ContentKey"
1414
data-col-span="@item.ColumnSpan"
1515
data-row-span="@item.RowSpan"
1616
style=" --umb-block-grid--item-column-span: @item.ColumnSpan; --umb-block-grid--item-row-span: @item.RowSpan; ">

src/Umbraco.Community.BlockPreview.UI/package-lock.json

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

src/Umbraco.Community.BlockPreview.UI/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "assets",
33
"private": true,
4-
"version": "4.0.0-rc5",
4+
"version": "4.0.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
@@ -19,7 +19,7 @@
1919
"devDependencies": {
2020
"@hey-api/client-fetch": "^0.10.0",
2121
"@hey-api/openapi-ts": "^0.66.6",
22-
"@umbraco-cms/backoffice": "16.0.0-rc5",
22+
"@umbraco-cms/backoffice": "16.0.0",
2323
"typescript": "^5.8.3",
2424
"vite": "^6.2.7"
2525
}

src/Umbraco.Community.BlockPreview.UI/public/umbraco-package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "../umbraco-package-schema.json",
33
"name": "Umbraco.Community.BlockPreview",
44
"id": "Umbraco.Community.BlockPreview",
5-
"version": "4.0.0-rc5",
5+
"version": "4.0.0",
66
"allowTelemetry": true,
77
"extensions": [
88
{

src/Umbraco.Community.BlockPreview.UI/src/blockEditor/block-grid-preview.custom-view.element.ts

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ export class BlockGridPreviewCustomView
3333

3434
@property({ attribute: false })
3535
config?: UmbBlockEditorCustomViewConfiguration;
36+
37+
@property({ attribute: false })
38+
unpublished?: boolean;
39+
40+
@property({ attribute: false })
41+
icon?: string;
42+
43+
@property({ attribute: false })
44+
label?: string;
3645

3746
@state()
3847
private _htmlMarkup: string = '';
@@ -47,6 +56,9 @@ export class BlockGridPreviewCustomView
4756

4857
private _previewTimeout: number | undefined;
4958

59+
@state()
60+
private _sortModeActive: boolean = false;
61+
5062
private _blockContext = {
5163
unique: "",
5264
documentTypeUnique: "",
@@ -103,11 +115,20 @@ export class BlockGridPreviewCustomView
103115
}
104116

105117
#setupContextObservers() {
118+
this.#observeSortMode();
106119
this.#observeBlockPreviewSettings();
107120
this.#observePropertyDataset();
108121
this.#observeDocumentWorkspace();
109122
}
110123

124+
#observeSortMode() {
125+
this.observe(this.#blockPreviewContext?.sortModeActive, (isActive) => {
126+
if (isActive !== undefined) {
127+
this._sortModeActive = isActive;
128+
}
129+
});
130+
}
131+
111132
#observeBlockPreviewSettings() {
112133
this.observe(this.#blockPreviewContext?.settings, (settings) => {
113134
if (settings?.blockGrid?.stylesheet) {
@@ -322,21 +343,22 @@ export class BlockGridPreviewCustomView
322343
}
323344
}
324345

325-
render() {
326-
if (this._isLoading) {
327-
return html`<div class="preview-alert preview-alert-info"><uui-loader style="color: #fff"></uui-loader> Loading preview...</div>`;
328-
}
346+
override render() {
347+
if (this._sortModeActive === false) {
348+
if (this._isLoading) {
349+
return html`<div class="preview-alert preview-alert-info"><uui-loader style="color: #fff"></uui-loader> Loading preview...</div>`;
350+
}
329351

330-
if (this._error) {
331-
return html`
352+
if (this._error) {
353+
return html`
332354
<div class="preview-alert preview-alert-error" role="alert">
333355
${this._error}
334356
</div>
335357
`;
336-
}
358+
}
337359

338-
if (this._htmlMarkup) {
339-
return html`
360+
if (this._htmlMarkup) {
361+
return html`
340362
${this._styleElement}
341363
<a
342364
href=${ifDefined(this._blockContext.workspaceEditContentPath)}
@@ -347,9 +369,19 @@ export class BlockGridPreviewCustomView
347369
${unsafeHTML(this._htmlMarkup)}
348370
</a>
349371
`;
372+
}
350373
}
351374

352-
return null;
375+
else return html`<umb-block-grid-block
376+
class="umb-block-grid__block--view"
377+
.label=${this.label}
378+
.icon=${this.icon}
379+
.unpublished=${this.unpublished}
380+
.config=${this.config}
381+
.content=${this.content}
382+
.settings=${this.settingsData}>
383+
</umb-block-grid-block>
384+
`;
353385
}
354386

355387
static styles = [

src/Umbraco.Community.BlockPreview.UI/src/blockEditor/block-list-preview.custom-view.element.ts

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ export class BlockListPreviewCustomView
3434
@property({ attribute: false })
3535
config?: UmbBlockEditorCustomViewConfiguration;
3636

37+
@property({ attribute: false })
38+
unpublished?: boolean;
39+
40+
@property({ attribute: false })
41+
icon?: string;
42+
43+
@property({ attribute: false })
44+
label?: string;
45+
3746
@state()
3847
private _htmlMarkup: string = '';
3948

@@ -47,6 +56,9 @@ export class BlockListPreviewCustomView
4756

4857
private _previewTimeout: number | undefined;
4958

59+
@state()
60+
private _sortModeActive: boolean = false;
61+
5062
private _blockContext = {
5163
unique: '',
5264
documentTypeUnique: '',
@@ -105,11 +117,20 @@ export class BlockListPreviewCustomView
105117
}
106118

107119
#setupContextObservers() {
120+
this.#observeSortMode();
108121
this.#observeBlockPreviewSettings();
109122
this.#observePropertyDataset();
110123
this.#observeDocumentWorkspace();
111124
}
112125

126+
#observeSortMode() {
127+
this.observe(this.#blockPreviewContext?.sortModeActive, (isActive) => {
128+
if (isActive !== undefined) {
129+
this._sortModeActive = isActive;
130+
}
131+
});
132+
}
133+
113134
#observeBlockPreviewSettings() {
114135
this.observe(this.#blockPreviewContext?.settings, (settings) => {
115136
if (settings?.blockList?.stylesheet) {
@@ -304,34 +325,45 @@ export class BlockListPreviewCustomView
304325
}
305326
}
306327

307-
render() {
308-
if (this._isLoading) {
309-
return html`<div class="preview-alert preview-alert-info"><uui-loader style="color: #fff"></uui-loader> Loading preview...</div>`;
310-
}
328+
override render() {
329+
if (this._sortModeActive === false) {
330+
if (this._isLoading) {
331+
return html`<div class="preview-alert preview-alert-info"><uui-loader style="color: #fff"></uui-loader> Loading preview...</div>`;
332+
}
311333

312-
if (this._error) {
313-
return html`
314-
<div class="preview-alert preview-alert-error" role="alert">
315-
${this._error}
316-
</div>
317-
`;
318-
}
334+
if (this._error) {
335+
return html`
336+
<div class="preview-alert preview-alert-error" role="alert">
337+
${this._error}
338+
</div>
339+
`;
340+
}
319341

320-
if (this._htmlMarkup) {
321-
return html`
322-
${this._styleElement}
323-
<a
324-
href=${ifDefined(this._blockContext.workspaceEditContentPath)}
325-
@click=${this._handleClick}
326-
aria-label="Edit block"
327-
role="button"
328-
>
329-
${unsafeHTML(this._htmlMarkup)}
330-
</a>
331-
`;
342+
if (this._htmlMarkup) {
343+
return html`
344+
${this._styleElement}
345+
<a
346+
href=${ifDefined(this._blockContext.workspaceEditContentPath)}
347+
@click=${this._handleClick}
348+
aria-label="Edit block"
349+
role="button"
350+
>
351+
${unsafeHTML(this._htmlMarkup)}
352+
</a>
353+
`;
354+
}
332355
}
333356

334-
return null;
357+
else return html`<umb-ref-list-block
358+
class="umb-block-grid__block--view"
359+
.label=${this.label}
360+
.icon=${this.icon}
361+
.unpublished=${this.unpublished}
362+
.config=${this.config}
363+
.content=${this.content}
364+
.settings=${this.settingsData}>
365+
</umb-ref-list-block>
366+
`;
335367
}
336368

337369
static styles = [

src/Umbraco.Community.BlockPreview.UI/src/context/block-preview.context.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { UmbControllerBase } from "@umbraco-cms/backoffice/class-api";
22
import { UmbControllerHost } from "@umbraco-cms/backoffice/controller-api";
33
import { SettingsRepository } from "..";
4-
import { UmbObjectState, UmbStringState } from "@umbraco-cms/backoffice/observable-api";
4+
import { UmbBooleanState, UmbObjectState, UmbStringState } from "@umbraco-cms/backoffice/observable-api";
55
import { BlockPreviewOptions } from "../api";
66

77
export class BlockPreviewContext extends UmbControllerBase {
@@ -17,11 +17,15 @@ export class BlockPreviewContext extends UmbControllerBase {
1717
#documentTypeUnique = new UmbStringState('');
1818
public readonly documentTypeUnique = this.#documentTypeUnique.asObservable();
1919

20+
#sortModeActive = new UmbBooleanState(false);
21+
public readonly sortModeActive = this.#sortModeActive.asObservable();
22+
2023
constructor(host: UmbControllerHost) {
2124
super(host);
2225
this.#settingsRepository = new SettingsRepository(host);
2326

2427
this.getSettings();
28+
this.setSortMode(false);
2529
}
2630

2731
async getSettings() {
@@ -48,6 +52,14 @@ export class BlockPreviewContext extends UmbControllerBase {
4852
this.#documentTypeUnique.setValue(documentTypeUnique);
4953
}
5054
}
55+
56+
getSortMode(): boolean {
57+
return this.#sortModeActive.getValue();
58+
}
59+
60+
async setSortMode(sortMode: boolean) {
61+
this.#sortModeActive.setValue(sortMode);
62+
}
5163
}
5264

5365
export default BlockPreviewContext;

src/Umbraco.Community.BlockPreview.UI/src/index.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import { UmbEntryPointOnInit } from '@umbraco-cms/backoffice/extension-api';
21
import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth';
32
import { ManifestBlockEditorCustomView } from '@umbraco-cms/backoffice/block-custom-view';
3+
import { UmbEntryPointOnInit } from '@umbraco-cms/backoffice/extension-api';
44

5-
export * from './repository';
6-
export * from './blockEditor';
7-
8-
import { SettingsRepository } from './repository';
9-
import { BlockGridPreviewCustomView, RichTextPreviewCustomView, BlockListPreviewCustomView } from './blockEditor';
10-
import { manifests as contextManifests } from './context/manifests.ts';
115
import { client } from './api/index.ts';
6+
import { BlockGridPreviewCustomView, BlockListPreviewCustomView, RichTextPreviewCustomView } from './blockEditor';
127
import { BLOCK_PREVIEW_CONTEXT } from './context/block-preview.context-token.ts';
138
import BlockPreviewContext from './context/block-preview.context.ts';
9+
import { manifests as contextManifests } from './context/manifests.ts';
10+
import { manifests as propertyManifests } from './property/manifests.ts';
11+
import { manifests as propertyActionManifests } from './propertyActions/manifests.ts';
12+
import { SettingsRepository } from './repository';
13+
14+
export * from './blockEditor';
15+
export * from './repository';
1416

1517
export const onInit: UmbEntryPointOnInit = async (host, extensionRegistry) => {
1618

@@ -82,7 +84,9 @@ export const onInit: UmbEntryPointOnInit = async (host, extensionRegistry) => {
8284

8385
extensionRegistry.registerMany([
8486
...customViewManifests,
85-
...contextManifests
87+
...contextManifests,
88+
...propertyManifests,
89+
...propertyActionManifests
8690
]);
8791

8892
host.provideContext(BLOCK_PREVIEW_CONTEXT, new BlockPreviewContext(host));

0 commit comments

Comments
 (0)