Trusted/Not-trusted functionality implementation (#3211)

* 3194: Hookup trusted/not-trusted functionality and css changes

* 3194: Trusted implementation changes

* 3194: Code review changes

* 3225: No border in between code-cell and output
This commit is contained in:
Raj
2018-11-14 19:07:10 -08:00
committed by GitHub
parent e607f68b3e
commit 63cf0f1548
19 changed files with 145 additions and 17 deletions

View File

@@ -22,7 +22,8 @@ export const OUTPUT_SELECTOR: string = 'output-component';
export class OutputComponent extends AngularDisposable implements OnInit {
@ViewChild('output', { read: ElementRef }) private outputElement: ElementRef;
@Input() cellOutput: nb.ICellOutput;
@Input() trustedMode: boolean;
private _trusted: boolean;
private _initialized: boolean = false;
private readonly _minimumHeight = 30;
registry: RenderMimeRegistry;
@@ -35,6 +36,11 @@ export class OutputComponent extends AngularDisposable implements OnInit {
}
ngOnInit() {
this.renderOutput();
this._initialized = true;
}
private renderOutput() {
let node = this.outputElement.nativeElement;
let output = this.cellOutput;
let options = outputProcessor.getBundleOptions({ value: output, trusted: this.trustedMode });
@@ -45,6 +51,18 @@ export class OutputComponent extends AngularDisposable implements OnInit {
public layout(): void {
}
get trustedMode(): boolean {
return this._trusted;
}
@Input()
set trustedMode(value: boolean) {
this._trusted = value;
if (this._initialized) {
this.renderOutput();
}
}
protected createRenderedMimetype(options: MimeModel.IOptions, node: HTMLElement): void {
let mimeType = this.registry.preferredMimeType(
options.data,