mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-11-04 09:47:31 +03:00 
			
		
		
		
	Fix links with spaces
This commit is contained in:
		
							parent
							
								
									0a8440f44b
								
							
						
					
					
						commit
						7d7877da2e
					
				| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
<div class="method">
 | 
			
		||||
  <div class="method-content">
 | 
			
		||||
    <h2 class="method-header sharable-header">
 | 
			
		||||
      <a class="share-link" href="#{{data.methodAnchor}}"></a>{{data.methodInfo.summary}}
 | 
			
		||||
      <a class="share-link" href="#{{data.methodAnchor | encodeURIComponent }}"></a>{{data.methodInfo.summary}}
 | 
			
		||||
    </h2>
 | 
			
		||||
    <h3 class="method-endpoint">
 | 
			
		||||
      <span class="http-method" [ngClass]="data.httpMethod">{{data.httpMethod}}</span>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,13 +8,15 @@ import ResponsesList from '../ResponsesList/responses-list';
 | 
			
		|||
import ResponsesSamples from '../ResponsesSamples/responses-samples';
 | 
			
		||||
import SchemaSample from '../SchemaSample/schema-sample';
 | 
			
		||||
import RequestSamples from '../RequestSamples/request-samples';
 | 
			
		||||
import {EncodeURIComponentPipe} from '../../utils/pipes';
 | 
			
		||||
 | 
			
		||||
@RedocComponent({
 | 
			
		||||
  selector: 'method',
 | 
			
		||||
  templateUrl: './lib/components/Method/method.html',
 | 
			
		||||
  styleUrls: ['./lib/components/Method/method.css'],
 | 
			
		||||
  directives: [ParamsList, ResponsesList, ResponsesSamples, SchemaSample, RequestSamples],
 | 
			
		||||
  inputs: ['tag']
 | 
			
		||||
  inputs: ['tag'],
 | 
			
		||||
  pipes: [EncodeURIComponentPipe]
 | 
			
		||||
})
 | 
			
		||||
export default class Method extends BaseComponent {
 | 
			
		||||
  constructor(schemaMgr) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
<div class="methods">
 | 
			
		||||
  <div class="tag" *ngFor="#tag of data.tags">
 | 
			
		||||
    <div class="tag-info" [attr.tag]="tag.name">
 | 
			
		||||
      <h1 class="sharable-header"> <a class="share-link" href="#tag/{{tag.name}}"></a>{{tag.name}} </h1>
 | 
			
		||||
      <h1 class="sharable-header"> <a class="share-link" href="#tag/{{tag.name | encodeURIComponent}}"></a>{{tag.name}} </h1>
 | 
			
		||||
      <p *ngIf="tag.description" innerHtml="{{ tag.description | marked }}"> </p>
 | 
			
		||||
    </div>
 | 
			
		||||
    <method *ngFor="#method of tag.methods" [pointer]="method.pointer" [attr.pointer]="method.pointer"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,12 +2,14 @@
 | 
			
		|||
 | 
			
		||||
import {RedocComponent, BaseComponent} from '../base';
 | 
			
		||||
import Method from '../Method/method';
 | 
			
		||||
import {EncodeURIComponentPipe} from '../../utils/pipes';
 | 
			
		||||
 | 
			
		||||
@RedocComponent({
 | 
			
		||||
  selector: 'methods-list',
 | 
			
		||||
  templateUrl: './lib/components/MethodsList/methods-list.html',
 | 
			
		||||
  styleUrls: ['./lib/components/MethodsList/methods-list.css'],
 | 
			
		||||
  directives: [Method]
 | 
			
		||||
  directives: [Method],
 | 
			
		||||
  pipes: [EncodeURIComponentPipe]
 | 
			
		||||
})
 | 
			
		||||
export default class MethodsList extends BaseComponent {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ export default class SideMenu extends BaseComponent {
 | 
			
		|||
    let $el;
 | 
			
		||||
    hash = hash.substr(1);
 | 
			
		||||
    let namespace = hash.split('/')[0];
 | 
			
		||||
    let ptr = hash.substr(namespace.length + 1);
 | 
			
		||||
    let ptr = decodeURIComponent(hash.substr(namespace.length + 1));
 | 
			
		||||
    if (namespace === 'operation') {
 | 
			
		||||
      $el = this.getMethodElByOperId(ptr);
 | 
			
		||||
    } else if (namespace === 'tag') {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -118,3 +118,14 @@ export class PrismPipe {
 | 
			
		|||
    return Prism.highlight(value, grammar);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@Pipe({ name: 'encodeURIComponent' })
 | 
			
		||||
export class EncodeURIComponentPipe {
 | 
			
		||||
  transform(value) {
 | 
			
		||||
    if (isBlank(value)) return value;
 | 
			
		||||
    if (!isString(value)) {
 | 
			
		||||
      throw new InvalidPipeArgumentException(EncodeURIComponentPipe, value);
 | 
			
		||||
    }
 | 
			
		||||
    return encodeURIComponent(value);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user