V15/feature/notification-whitespace (#18190)

* feat: adds `white-space: pre-line` to all notification messages

* chore: remove invalid values
This commit is contained in:
Jacob Overgaard
2025-01-31 21:26:19 +01:00
committed by GitHub
parent 3157601724
commit 2cdcacb9a8
3 changed files with 5 additions and 5 deletions

View File

@@ -6,7 +6,6 @@ import {
ifDefined,
nothing,
css,
styleMap,
} from '@umbraco-cms/backoffice/external/lit';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type { UmbNotificationDefaultData, UmbNotificationHandler } from '@umbraco-cms/backoffice/notification';
@@ -24,7 +23,7 @@ export class UmbNotificationLayoutDefaultElement extends LitElement {
override render() {
return html`
<uui-toast-notification-layout id="layout" headline="${ifDefined(this.data.headline)}" class="uui-text">
<div id="message" style=${styleMap({ whiteSpace: this.data.whitespace })}>${this.data.message}</div>
<div id="message">${this.data.message}</div>
${this.#renderStructuredList(this.data.structuredList)}
</uui-toast-notification-layout>
`;
@@ -56,6 +55,9 @@ export class UmbNotificationLayoutDefaultElement extends LitElement {
static override styles = [
UmbTextStyles,
css`
#message {
white-space: pre-line;
}
.structured-list ul {
margin: 0;
}

View File

@@ -12,7 +12,6 @@ export interface UmbNotificationDefaultData {
message: string;
headline?: string;
structuredList?: Record<string, Array<unknown>>;
whitespace?: 'normal' | 'pre-line' | 'pre-wrap' | 'nowrap' | 'pre';
}
/**

View File

@@ -89,10 +89,9 @@ export class UmbTemporaryFileManager<
headline: 'Upload',
message: `
${this.#localization.term('media_invalidFileSize')}: ${item.file.name} (${formatBytes(item.file.size)}).
${this.#localization.term('media_maxFileSize')} ${formatBytes(maxFileSize)}.
`,
whitespace: 'pre-line',
},
});
return false;