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

Commit 5a38fec

Browse files
[v14.2+] Fix Block Grid layoutStylesheet not using correct URL (#2512)
* Update block-grid-manager.context.ts * Renames field to `serverUrl` Uses `URL()` object to handle slashes in constructing the URL path. * Tidied up imports --------- Co-authored-by: leekelleher <[email protected]>
1 parent 3eef6b0 commit 5a38fec

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/packages/block/block-grid/context/block-grid-manager.context.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
import type { UmbBlockGridLayoutModel, UmbBlockGridTypeModel } from '../types.js';
22
import type { UmbBlockGridWorkspaceOriginData } from '../index.js';
33
import {
4-
UmbArrayState,
5-
UmbBooleanState,
64
appendToFrozenArray,
75
pushAtToUniqueArray,
6+
UmbArrayState,
7+
UmbBooleanState,
88
} from '@umbraco-cms/backoffice/observable-api';
9-
import { removeLastSlashFromPath, transformServerPathToClientPath } from '@umbraco-cms/backoffice/utils';
10-
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
9+
import { transformServerPathToClientPath } from '@umbraco-cms/backoffice/utils';
10+
import { UmbBlockManagerContext } from '@umbraco-cms/backoffice/block';
1111
import { UMB_APP_CONTEXT } from '@umbraco-cms/backoffice/app';
12-
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
13-
import { type UmbBlockDataModel, UmbBlockManagerContext } from '@umbraco-cms/backoffice/block';
12+
import type { UmbBlockDataModel } from '@umbraco-cms/backoffice/block';
1413
import type { UmbBlockTypeGroup } from '@umbraco-cms/backoffice/block-type';
14+
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
1515
import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models';
16+
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
1617

1718
export const UMB_BLOCK_GRID_DEFAULT_LAYOUT_STYLESHEET = '/umbraco/backoffice/css/umbraco-blockgridlayout.css';
1819

@@ -34,7 +35,9 @@ export class UmbBlockGridManagerContext<
3435
}
3536

3637
#initAppUrl: Promise<void>;
37-
#appUrl?: string;
38+
39+
#serverUrl?: string;
40+
3841
#blockGroups = new UmbArrayState(<Array<UmbBlockTypeGroup>>[], (x) => x.key);
3942
public readonly blockGroups = this.#blockGroups.asObservable();
4043

@@ -45,7 +48,8 @@ export class UmbBlockGridManagerContext<
4548

4649
if (layoutStylesheet) {
4750
// Cause we await initAppUrl in setting the _editorConfiguration, we can trust the appUrl begin here.
48-
return removeLastSlashFromPath(this.#appUrl!) + transformServerPathToClientPath(layoutStylesheet);
51+
const url = new URL(transformServerPathToClientPath(layoutStylesheet), this.#serverUrl);
52+
return url.href;
4953
}
5054
return undefined;
5155
});
@@ -85,7 +89,7 @@ export class UmbBlockGridManagerContext<
8589
super(host);
8690

8791
this.#initAppUrl = this.getContext(UMB_APP_CONTEXT).then((appContext) => {
88-
this.#appUrl = appContext.getServerUrl() + appContext.getBackofficePath();
92+
this.#serverUrl = appContext.getServerUrl();
8993
});
9094
}
9195

0 commit comments

Comments
 (0)