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.
54 lines
1.2 KiB
54 lines
1.2 KiB
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { Pipe, PipeTransform } from '@angular/core';
|
|
import { DomSanitizer, SafeHtml, SafeResourceUrl, SafeUrl } 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): SafeUrl {
|
|
return this.domSanitizer.bypassSecurityTrustUrl(url);
|
|
}
|
|
}
|
|
|
|
@Pipe({
|
|
name: 'sqxSafeResourceUrl',
|
|
pure: true,
|
|
})
|
|
export class SafeResourceUrlPipe implements PipeTransform {
|
|
constructor(
|
|
public readonly domSanitizer: DomSanitizer,
|
|
) {
|
|
}
|
|
|
|
public transform(url: string): SafeResourceUrl {
|
|
return this.domSanitizer.bypassSecurityTrustResourceUrl(url);
|
|
}
|
|
}
|
|
|