diff --git a/demo/index.tsx b/demo/index.tsx
index 68d072ba..c61a045f 100644
--- a/demo/index.tsx
+++ b/demo/index.tsx
@@ -1,18 +1,18 @@
import * as React from 'react';
-import { render } from 'react-dom';
+import {render} from 'react-dom';
import styled from 'styled-components';
-import { resolve as urlResolve } from 'url';
-import { RedocStandalone } from '../src';
+import {resolve as urlResolve} from 'url';
+import {RedocStandalone} from '../src';
import ComboBox from './ComboBox';
const demos = [
- { value: 'https://api.apis.guru/v2/specs/instagram.com/1.0.0/swagger.yaml', label: 'Instagram' },
+ {value: 'https://api.apis.guru/v2/specs/instagram.com/1.0.0/swagger.yaml', label: 'Instagram'},
{
value: 'https://api.apis.guru/v2/specs/googleapis.com/calendar/v3/swagger.yaml',
label: 'Google Calendar',
},
- { value: 'https://api.apis.guru/v2/specs/slack.com/1.0.6/swagger.yaml', label: 'Slack' },
- { value: 'https://api.apis.guru/v2/specs/zoom.us/2.0.0/swagger.yaml', label: 'Zoom.us' },
+ {value: 'https://api.apis.guru/v2/specs/slack.com/1.0.6/swagger.yaml', label: 'Slack'},
+ {value: 'https://api.apis.guru/v2/specs/zoom.us/2.0.0/swagger.yaml', label: 'Zoom.us'},
{
value: 'https://api.apis.guru/v2/specs/graphhopper.com/1.0/swagger.yaml',
label: 'GraphHopper',
@@ -21,10 +21,8 @@ const demos = [
const DEFAULT_SPEC = 'openapi.yaml';
-class DemoApp extends React.Component<
- {},
- { specUrl: string; dropdownOpen: boolean; cors: boolean }
-> {
+class DemoApp extends React.Component<{},
+ { specUrl: string; dropdownOpen: boolean; cors: boolean }> {
constructor(props) {
super(props);
@@ -71,7 +69,7 @@ class DemoApp extends React.Component<
};
render() {
- const { specUrl, cors } = this.state;
+ const {specUrl, cors} = this.state;
let proxiedUrl = specUrl;
if (specUrl !== DEFAULT_SPEC) {
proxiedUrl = cors
@@ -82,7 +80,7 @@ class DemoApp extends React.Component<
<>
-
+
-
+
@@ -104,7 +102,7 @@ class DemoApp extends React.Component<
height="30px"
/>
-
+
>
);
}
diff --git a/src/components/ContentItems/SingleContentItem.tsx b/src/components/ContentItems/SingleContentItem.tsx
index e69de29b..52a8a78a 100644
--- a/src/components/ContentItems/SingleContentItem.tsx
+++ b/src/components/ContentItems/SingleContentItem.tsx
@@ -0,0 +1,31 @@
+import {observer} from 'mobx-react';
+import * as React from 'react';
+import {IMenuItem, MenuStore} from '../../services';
+import {ContentItems} from './ContentItems';
+
+@observer
+export class SingleContentItem extends React.Component<{
+ menu: MenuStore;
+}> {
+
+ extractActive(menu: MenuStore): IMenuItem[] {
+ const active = menu.flatItems[menu.activeItemIdx];
+ if (!active) {
+ return [menu.flatItems[0]];
+ }
+ if (active.type !== 'operation') {
+ return [
+ {...active, items: []},
+ ];
+ }
+ return [active];
+ }
+
+ render() {
+ const { menu } = this.props;
+ const activeItems = this.extractActive(menu);
+ return (
+
+ );
+ }
+}
diff --git a/src/components/Redoc/Redoc.tsx b/src/components/Redoc/Redoc.tsx
index 2b43e77d..e6e67dd0 100644
--- a/src/components/Redoc/Redoc.tsx
+++ b/src/components/Redoc/Redoc.tsx
@@ -4,7 +4,7 @@ import * as React from 'react';
import { ThemeProvider } from '../../styled-components';
import { OptionsProvider } from '../OptionsProvider';
-import { AppStore } from '../../services';
+import {AppStore} from '../../services';
import { ApiInfo } from '../ApiInfo/';
import { ApiLogo } from '../ApiLogo/ApiLogo';
import { ContentItems } from '../ContentItems/ContentItems';
@@ -12,6 +12,7 @@ import { SideMenu } from '../SideMenu/SideMenu';
import { StickyResponsiveSidebar } from '../StickySidebar/StickyResponsiveSidebar';
import { ApiContentWrap, BackgroundStub, RedocWrap } from './styled.elements';
+import {SingleContentItem} from '../ContentItems/SingleContentItem';
import { SearchBox } from '../SearchBox/SearchBox';
import { StoreProvider } from '../StoreBuilder';
@@ -57,7 +58,10 @@ export class Redoc extends React.Component {
-
+ {options.disableInfiniteScroll
+ ?
+ :
+ }
diff --git a/src/services/ScrollService.ts b/src/services/ScrollService.ts
index 3e946c37..6bcf4dd5 100644
--- a/src/services/ScrollService.ts
+++ b/src/services/ScrollService.ts
@@ -18,13 +18,13 @@ export class ScrollService {
bind() {
this._prevOffsetY = this.scrollY();
- if (this._scrollParent) {
+ if (this._scrollParent && !this.options.disableInfiniteScroll) {
this._scrollParent.addEventListener('scroll', this.handleScroll);
}
}
dispose() {
- if (this._scrollParent) {
+ if (this._scrollParent && !this.options.disableInfiniteScroll) {
this._scrollParent.removeEventListener('scroll', this.handleScroll);
}
this._emiter.removeAllListeners(EVENT);