feat: Update version to 3.0.2 and add default footer elements for portal settings

This commit is contained in:
Torsten Brendgen
2026-08-18 16:09:16 +02:00
parent 6f548362e2
commit c529716a18
10 changed files with 94 additions and 15 deletions
@@ -46,7 +46,7 @@ export function normalizeBrandingConfig(
}
if (serializedLength > MaxBrandingConfigurationLength) {
warnings.push('Configuration exceeds the maximum size and was ignored.');
return { config: createEmptyConfig(), warnings: warnings };
return { config: createEmptyConfig(siteCollectionUrl), warnings: warnings };
}
const allowedCssHosts: string[] = normalizeHosts(raw.allowedCssHosts);
@@ -54,9 +54,12 @@ export function normalizeBrandingConfig(
const topSource: any[] = raw.placeholdertop && Array.isArray(raw.placeholdertop.elements)
? raw.placeholdertop.elements
: (Array.isArray(raw.elements) ? raw.elements : []);
const bottomSource: any[] = raw.placeholderbottom && Array.isArray(raw.placeholderbottom.elements)
const configuredBottomSource: any[] = raw.placeholderbottom && Array.isArray(raw.placeholderbottom.elements)
? raw.placeholderbottom.elements
: [];
const bottomSource: any[] = configuredBottomSource.length > 0
? configuredBottomSource
: createDefaultFooterElements();
const config: ICustomBrandingConfig = {
schemaVersion: BrandingSchemaVersion,
@@ -127,7 +130,8 @@ export function sanitizeStyle(propertyName: string, value: string): string | und
return styleValue;
}
function createEmptyConfig(): ICustomBrandingConfig {
function createEmptyConfig(siteCollectionUrl: string): ICustomBrandingConfig {
const state: INormalizationState = { count: 0, warnings: [], siteCollectionUrl: siteCollectionUrl || '' };
return {
schemaVersion: BrandingSchemaVersion,
portalSettings: createPortalSettingsDescriptor(),
@@ -136,10 +140,26 @@ function createEmptyConfig(): ICustomBrandingConfig {
allowedCssHosts: [],
cssfiles: [],
placeholdertop: { elements: [] },
placeholderbottom: { elements: [] }
placeholderbottom: { elements: normalizeElements(createDefaultFooterElements(), 1, state) }
};
}
function createDefaultFooterElements(): any[] {
return [{
type: 'div',
attributes: { role: 'contentinfo', 'aria-label': 'Portalverwaltung' },
styles: {
'background-color': '#323130', color: '#ffffff', padding: '12px 16px',
'text-align': 'center', width: '100%', 'box-sizing': 'border-box'
},
children: [{
type: 'a', content: 'Portal Settings',
attributes: { href: '~sitecollection/SitePages/PortalSettings.aspx' },
styles: { color: '#ffffff', 'text-decoration': 'underline' }
}]
}];
}
function createPortalSettingsDescriptor(): IPortalSettingsDescriptor {
return {
providerKey: 'custombranding',