mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:11:32 +00:00
Stop filtering JS code in bot messages
This commit is contained in:
parent
031a9916a0
commit
d8545c48be
@ -17,7 +17,7 @@ import { TerminalComponent } from './terminal/terminal.component';
|
|||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { TestmessengerComponent } from './testmessenger/testmessenger.component';
|
import { TestmessengerComponent } from './testmessenger/testmessenger.component';
|
||||||
import { DeploymentNotificationService } from './services/deployment-notification.service';
|
import { DeploymentNotificationService } from './services/deployment-notification.service';
|
||||||
import { SafePipe } from './pipes/safe.pipe';
|
import { SafePipe, SafeHtmlPipe } from './pipes/safe.pipe';
|
||||||
import { ConsoleComponent } from './console/console.component';
|
import { ConsoleComponent } from './console/console.component';
|
||||||
import { MonacoEditorModule } from 'ngx-monaco-editor';
|
import { MonacoEditorModule } from 'ngx-monaco-editor';
|
||||||
import {
|
import {
|
||||||
@ -41,6 +41,7 @@ import { LoaderComponent } from './loader/loader.component';
|
|||||||
DashboardComponent,
|
DashboardComponent,
|
||||||
TestmessengerComponent,
|
TestmessengerComponent,
|
||||||
SafePipe,
|
SafePipe,
|
||||||
|
SafeHtmlPipe,
|
||||||
ConsoleComponent,
|
ConsoleComponent,
|
||||||
LoaderComponent
|
LoaderComponent
|
||||||
],
|
],
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<div class="tao-grid-center-left originator">{{message.originator}}</div>
|
<div class="tao-grid-center-left originator">{{message.originator}}</div>
|
||||||
<div class="timestamp tao-grid-center-right">{{message.timestamp | date:'HH:mm:ss'}}</div>
|
<div class="timestamp tao-grid-center-right">{{message.timestamp | date:'HH:mm:ss'}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tfw-grid-message-body" [innerHtml]="message.message"></div>
|
<div class="tfw-grid-message-body" [innerHtml]="message.message | safeHtml"></div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="showTypingIndicator"
|
<div *ngIf="showTypingIndicator"
|
||||||
class="tfw-grid-message jumping-circle-container"
|
class="tfw-grid-message jumping-circle-container"
|
||||||
|
@ -11,3 +11,14 @@ export class SafePipe implements PipeTransform {
|
|||||||
return this.sanitizer.bypassSecurityTrustResourceUrl(value);
|
return this.sanitizer.bypassSecurityTrustResourceUrl(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Pipe({
|
||||||
|
name: 'safeHtml'
|
||||||
|
})
|
||||||
|
export class SafeHtmlPipe implements PipeTransform {
|
||||||
|
constructor(private sanitized: DomSanitizer) {}
|
||||||
|
|
||||||
|
transform(value) {
|
||||||
|
return this.sanitized.bypassSecurityTrustHtml(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user