Add no-sanitize pipe

This commit is contained in:
hunicus 2022-03-27 01:19:48 -04:00
parent c6c335921c
commit 663cf100d1
No known key found for this signature in database
GPG Key ID: 24837C51B6D81FD9
2 changed files with 13 additions and 0 deletions

View File

@ -56,6 +56,7 @@ import { faFilter, faAngleDown, faAngleUp, faAngleRight, faAngleLeft, faBolt, fa
import { ApiDocsComponent } from './components/docs/api-docs.component';
import { DocsComponent } from './components/docs/docs.component';
import { ApiDocsNavComponent } from './components/docs/api-docs-nav.component';
import { NoSanitizePipe } from './shared/pipes/no-sanitize.pipe';
import { CodeTemplateComponent } from './components/docs/code-template.component';
import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component';
import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component';
@ -119,6 +120,7 @@ import { DataCyDirective } from './data-cy.directive';
DashboardComponent,
DifficultyComponent,
ApiDocsComponent,
NoSanitizePipe,
CodeTemplateComponent,
TermsOfServiceComponent,
PrivacyPolicyComponent,

View File

@ -0,0 +1,11 @@
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@Pipe({ name: 'noSanitize' })
export class NoSanitizePipe implements PipeTransform {
constructor(private domSanitizer: DomSanitizer) { }
transform(html: string): SafeHtml {
return this.domSanitizer.bypassSecurityTrustHtml(html);
}
}