mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
848 B
39 lines
848 B
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { Pipe, PipeTransform } from '@angular/core';
|
|
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
|
|
@Pipe({
|
|
name: 'sqxSafeHtml',
|
|
pure: true
|
|
})
|
|
export class SafeHtmlPipe implements PipeTransform {
|
|
constructor(
|
|
public readonly domSanitizer: DomSanitizer
|
|
) {
|
|
}
|
|
|
|
public transform(html: string): SafeHtml {
|
|
return this.domSanitizer.bypassSecurityTrustHtml(html);
|
|
}
|
|
}
|
|
|
|
@Pipe({
|
|
name: 'sqxSafeUrl',
|
|
pure: true
|
|
})
|
|
export class SafeUrlPipe implements PipeTransform {
|
|
constructor(
|
|
public readonly domSanitizer: DomSanitizer
|
|
) {
|
|
}
|
|
|
|
public transform(url: string): SafeHtml {
|
|
return this.domSanitizer.bypassSecurityTrustUrl(url);
|
|
}
|
|
}
|