mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-12 07:50:34 +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>
|
<header *ngIf="schemaPointer || samples.length"> Request samples </header>
|
||||||
<schema-sample *ngIf="schemaPointer && !samples.length" [skipReadOnly]="true" [pointer]="schemaPointer"> </schema-sample>
|
<schema-sample *ngIf="schemaPointer && !samples.length" [skipReadOnly]="true" [pointer]="schemaPointer"> </schema-sample>
|
||||||
<tabs *ngIf="samples.length" [selected] = "selectedLang" (change)=changeLangNotify($event)>
|
<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>
|
<schema-sample [pointer]="schemaPointer" [skipReadOnly]="true"> </schema-sample>
|
||||||
</tab>
|
</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="code-sample">
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<span copy-button [copyText]="sample.source" class="hint--top-left hint--inversed"><a>Copy</a></span>
|
<span copy-button [copyText]="sample.source" class="hint--top-left hint--inversed"><a>Copy</a></span>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngFor="let tab of tabs" [ngClass]="{active: tab.active}" (click)="selectTab(tab)"
|
<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>
|
</ul>
|
||||||
<ng-content></ng-content>
|
<ng-content></ng-content>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
import { Pipe, PipeTransform } from '@angular/core';
|
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 { isString, stringify, isBlank } from './helpers';
|
||||||
import JsonPointer from './JsonPointer';
|
import JsonPointer from './JsonPointer';
|
||||||
import { MdRenderer } from './';
|
import { MdRenderer } from './';
|
||||||
|
@ -66,13 +66,13 @@ export class MarkedPipe implements PipeTransform {
|
||||||
@Pipe({ name: 'safe' })
|
@Pipe({ name: 'safe' })
|
||||||
export class SafePipe implements PipeTransform {
|
export class SafePipe implements PipeTransform {
|
||||||
constructor(private sanitizer: DomSanitizer) {}
|
constructor(private sanitizer: DomSanitizer) {}
|
||||||
transform(value:string) {
|
transform(value:string|SafeHtml):SafeHtml {
|
||||||
if (isBlank(value)) return value;
|
if (isBlank(value)) return value;
|
||||||
if (!isString(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