fix: undo section id + some minor fixes

This commit is contained in:
Roman Hotsiy 2018-01-10 19:20:35 +02:00
parent b7f0a1a4c4
commit 0253c5d76d
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
6 changed files with 13 additions and 9 deletions

View File

@ -59,12 +59,11 @@ export class ContentItem extends React.Component<ContentItemProps> {
export class TagItem extends React.Component<ContentItemProps> {
render() {
const { name, description } = this.props.item;
const hash = this.props.item.getHash();
return (
<Row>
<MiddlePanel key="middle">
<H1 id={hash}>
<ShareLink href={'#' + hash} />
<H1>
<ShareLink href={'#' + this.props.item.getHash()} />
{name}
</H1>
{description !== undefined && <Markdown source={description} />}

View File

@ -44,12 +44,11 @@ export class Operation extends ComponentWithOptions<OperationProps> {
const { name: summary, description, deprecated } = operation;
const pathInMiddle = this.options.pathInMiddlePanel;
const hash = operation.getHash();
return (
<OperationRow>
<MiddlePanel>
<H2 id={hash}>
<ShareLink href={'#' + hash} />
<H2>
<ShareLink href={'#' + operation.getHash()} />
{summary} {deprecated && <Badge type="warning"> Deprecated </Badge>}
</H2>
{pathInMiddle && <Endpoint operation={operation} inverted={true} />}

View File

@ -25,6 +25,10 @@ export class Redoc extends React.Component<RedocProps> {
this.props.store.menu.updateOnHash();
}
componentWillUnmount() {
this.props.store.dispose();
}
render() {
const { store: { spec, menu, options } } = this.props;
const store = this.props.store;

View File

@ -82,7 +82,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
<div>
{this.props.securitySchemes.schemes.map(scheme => (
<div data-section-id={scheme.sectionId} key={scheme.id}>
<H2 id={scheme.sectionId}>
<H2>
<ShareLink href={'#' + scheme.sectionId} />
{scheme.id}
</H2>

View File

@ -16,7 +16,7 @@ export class SideMenu extends ComponentWithOptions<{ menu: MenuStore }> {
<MenuItems
style={{
overflow: 'auto',
'-ms-overflow-style': '-ms-autohiding-scrollbar',
msOverflowStyle: '-ms-autohiding-scrollbar',
}}
items={store.items}
onActivate={this.activate}

View File

@ -133,7 +133,9 @@ export class MenuStore {
return (item as OperationModel).operationId === ptr;
});
}
if (item) {
this.activateAndScroll(item, false);
}
return item !== undefined;
}