mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 13:30:33 +03:00
fix: code samples language sync broken
This commit is contained in:
parent
c1dbb81aac
commit
6643d09a3a
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user