fix: code samples language sync broken

This commit is contained in:
Roman Hotsiy 2017-02-27 16:27:57 +02:00
parent c1dbb81aac
commit 6643d09a3a
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
3 changed files with 7 additions and 7 deletions

View File

@ -1,10 +1,10 @@
<header *ngIf="schemaPointer || samples.length"> Request samples </header>
<schema-sample *ngIf="schemaPointer && !samples.length" [skipReadOnly]="true" [pointer]="schemaPointer"> </schema-sample>
<tabs *ngIf="samples.length" [selected] = "selectedLang" (change)=changeLangNotify($event)>
<tab *ngIf="schemaPointer" [tabTitle]="'JSON' | safe">
<tab *ngIf="schemaPointer" tabTitle="JSON">
<schema-sample [pointer]="schemaPointer" [skipReadOnly]="true"> </schema-sample>
</tab>
<tab *ngFor="let sample of samples" [tabTitle]="sample.lang | safe">
<tab *ngFor="let sample of samples" [tabTitle]="sample.lang">
<div class="code-sample">
<div class="action-buttons">
<span copy-button [copyText]="sample.source" class="hint--top-left hint--inversed"><a>Copy</a></span>

View File

@ -1,5 +1,5 @@
<ul>
<li *ngFor="let tab of tabs" [ngClass]="{active: tab.active}" (click)="selectTab(tab)"
class="tab-{{tab.tabStatus}}" [innerHtml]="tab.tabTitle"></li>
class="tab-{{tab.tabStatus}}" [innerHtml]="tab.tabTitle | safe"></li>
</ul>
<ng-content></ng-content>

View File

@ -1,7 +1,7 @@
'use strict';
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { isString, stringify, isBlank } from './helpers';
import JsonPointer from './JsonPointer';
import { MdRenderer } from './';
@ -66,13 +66,13 @@ export class MarkedPipe implements PipeTransform {
@Pipe({ name: 'safe' })
export class SafePipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}
transform(value:string) {
transform(value:string|SafeHtml):SafeHtml {
if (isBlank(value)) return value;
if (!isString(value)) {
throw new InvalidPipeArgumentException(JsonPointerEscapePipe, value);
return value;
}
return this.sanitizer.bypassSecurityTrustHtml(value);
return this.sanitizer.bypassSecurityTrustHtml(value as string);
}
}