mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-26 18:43:43 +03:00
fix: undo section id + some minor fixes
This commit is contained in:
parent
b7f0a1a4c4
commit
0253c5d76d
|
@ -59,12 +59,11 @@ export class ContentItem extends React.Component<ContentItemProps> {
|
||||||
export class TagItem extends React.Component<ContentItemProps> {
|
export class TagItem extends React.Component<ContentItemProps> {
|
||||||
render() {
|
render() {
|
||||||
const { name, description } = this.props.item;
|
const { name, description } = this.props.item;
|
||||||
const hash = this.props.item.getHash();
|
|
||||||
return (
|
return (
|
||||||
<Row>
|
<Row>
|
||||||
<MiddlePanel key="middle">
|
<MiddlePanel key="middle">
|
||||||
<H1 id={hash}>
|
<H1>
|
||||||
<ShareLink href={'#' + hash} />
|
<ShareLink href={'#' + this.props.item.getHash()} />
|
||||||
{name}
|
{name}
|
||||||
</H1>
|
</H1>
|
||||||
{description !== undefined && <Markdown source={description} />}
|
{description !== undefined && <Markdown source={description} />}
|
||||||
|
|
|
@ -44,12 +44,11 @@ export class Operation extends ComponentWithOptions<OperationProps> {
|
||||||
|
|
||||||
const { name: summary, description, deprecated } = operation;
|
const { name: summary, description, deprecated } = operation;
|
||||||
const pathInMiddle = this.options.pathInMiddlePanel;
|
const pathInMiddle = this.options.pathInMiddlePanel;
|
||||||
const hash = operation.getHash();
|
|
||||||
return (
|
return (
|
||||||
<OperationRow>
|
<OperationRow>
|
||||||
<MiddlePanel>
|
<MiddlePanel>
|
||||||
<H2 id={hash}>
|
<H2>
|
||||||
<ShareLink href={'#' + hash} />
|
<ShareLink href={'#' + operation.getHash()} />
|
||||||
{summary} {deprecated && <Badge type="warning"> Deprecated </Badge>}
|
{summary} {deprecated && <Badge type="warning"> Deprecated </Badge>}
|
||||||
</H2>
|
</H2>
|
||||||
{pathInMiddle && <Endpoint operation={operation} inverted={true} />}
|
{pathInMiddle && <Endpoint operation={operation} inverted={true} />}
|
||||||
|
|
|
@ -25,6 +25,10 @@ export class Redoc extends React.Component<RedocProps> {
|
||||||
this.props.store.menu.updateOnHash();
|
this.props.store.menu.updateOnHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.props.store.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { store: { spec, menu, options } } = this.props;
|
const { store: { spec, menu, options } } = this.props;
|
||||||
const store = this.props.store;
|
const store = this.props.store;
|
||||||
|
|
|
@ -82,7 +82,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
|
||||||
<div>
|
<div>
|
||||||
{this.props.securitySchemes.schemes.map(scheme => (
|
{this.props.securitySchemes.schemes.map(scheme => (
|
||||||
<div data-section-id={scheme.sectionId} key={scheme.id}>
|
<div data-section-id={scheme.sectionId} key={scheme.id}>
|
||||||
<H2 id={scheme.sectionId}>
|
<H2>
|
||||||
<ShareLink href={'#' + scheme.sectionId} />
|
<ShareLink href={'#' + scheme.sectionId} />
|
||||||
{scheme.id}
|
{scheme.id}
|
||||||
</H2>
|
</H2>
|
||||||
|
|
|
@ -16,7 +16,7 @@ export class SideMenu extends ComponentWithOptions<{ menu: MenuStore }> {
|
||||||
<MenuItems
|
<MenuItems
|
||||||
style={{
|
style={{
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
'-ms-overflow-style': '-ms-autohiding-scrollbar',
|
msOverflowStyle: '-ms-autohiding-scrollbar',
|
||||||
}}
|
}}
|
||||||
items={store.items}
|
items={store.items}
|
||||||
onActivate={this.activate}
|
onActivate={this.activate}
|
||||||
|
|
|
@ -133,7 +133,9 @@ export class MenuStore {
|
||||||
return (item as OperationModel).operationId === ptr;
|
return (item as OperationModel).operationId === ptr;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.activateAndScroll(item, false);
|
if (item) {
|
||||||
|
this.activateAndScroll(item, false);
|
||||||
|
}
|
||||||
return item !== undefined;
|
return item !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user