Browse Source
Merge pull request #16049 from abpframework/feat/16026
page-alert-container component updated for HTML content
pull/16112/head
Masum ULU
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
25 additions and
4 deletions
-
npm/ng-packs/packages/core/src/lib/core.module.ts
-
npm/ng-packs/packages/core/src/lib/pipes/index.ts
-
npm/ng-packs/packages/core/src/lib/pipes/safe-html.pipe.ts
-
npm/ng-packs/packages/theme-basic/src/lib/components/page-alert-container/page-alert-container.component.html
|
|
|
@ -33,6 +33,7 @@ import { getInitialData, localeInitializer } from './utils/initial-utils'; |
|
|
|
import { ShortDateTimePipe } from './pipes/short-date-time.pipe'; |
|
|
|
import { ShortTimePipe } from './pipes/short-time.pipe'; |
|
|
|
import { ShortDatePipe } from './pipes/short-date.pipe'; |
|
|
|
import { SafeHtmlPipe } from './pipes/safe-html.pipe'; |
|
|
|
import { QUEUE_MANAGER } from './tokens/queue.token'; |
|
|
|
import { DefaultQueueManager } from './utils/queue'; |
|
|
|
import { IncludeLocalizationResourcesProvider } from './providers/include-localization-resources.provider'; |
|
|
|
@ -63,6 +64,7 @@ import { IncludeLocalizationResourcesProvider } from './providers/include-locali |
|
|
|
ReplaceableTemplateDirective, |
|
|
|
RouterOutletComponent, |
|
|
|
SortPipe, |
|
|
|
SafeHtmlPipe, |
|
|
|
StopPropagationDirective, |
|
|
|
ToInjectorPipe, |
|
|
|
ShortDateTimePipe, |
|
|
|
@ -90,6 +92,7 @@ import { IncludeLocalizationResourcesProvider } from './providers/include-locali |
|
|
|
ReplaceableTemplateDirective, |
|
|
|
RouterOutletComponent, |
|
|
|
SortPipe, |
|
|
|
SafeHtmlPipe, |
|
|
|
StopPropagationDirective, |
|
|
|
ToInjectorPipe, |
|
|
|
ShortDateTimePipe, |
|
|
|
|
|
|
|
@ -1,4 +1,5 @@ |
|
|
|
export * from './localization.pipe'; |
|
|
|
export * from './safe-html.pipe'; |
|
|
|
export * from './sort.pipe'; |
|
|
|
export * from './to-injector.pipe'; |
|
|
|
export * from './short-date.pipe'; |
|
|
|
|
|
|
|
@ -0,0 +1,13 @@ |
|
|
|
import { inject, Injectable, Pipe, PipeTransform, SecurityContext } from '@angular/core'; |
|
|
|
import { DomSanitizer } from '@angular/platform-browser'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
@Pipe({ name: 'abpSafeHtml' }) |
|
|
|
export class SafeHtmlPipe implements PipeTransform { |
|
|
|
private readonly sanitizer = inject(DomSanitizer); |
|
|
|
|
|
|
|
transform(value: string): string { |
|
|
|
if (typeof value !== 'string') return ''; |
|
|
|
return this.sanitizer.sanitize(SecurityContext.HTML, value); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -4,10 +4,14 @@ |
|
|
|
[ngClass]="{ 'alert-dismissible fade show': alert.dismissible }" |
|
|
|
role="alert" |
|
|
|
> |
|
|
|
<h4 class="alert-heading" *ngIf="alert.title"> |
|
|
|
{{ alert.title | abpLocalization: alert.titleLocalizationParams }} |
|
|
|
</h4> |
|
|
|
{{ alert.message | abpLocalization: alert.messageLocalizationParams }} |
|
|
|
<h4 |
|
|
|
class="alert-heading" |
|
|
|
*ngIf="alert.title" |
|
|
|
[innerHTML]="alert.title | abpSafeHtml | abpLocalization: alert.titleLocalizationParams" |
|
|
|
></h4> |
|
|
|
<span |
|
|
|
[innerHTML]="alert.message | abpSafeHtml | abpLocalization: alert.messageLocalizationParams" |
|
|
|
></span> |
|
|
|
<button |
|
|
|
*ngIf="alert.dismissible" |
|
|
|
type="button" |
|
|
|
|