diff --git a/src/services/AppStore.ts b/src/services/AppStore.ts index 75fb64d9..7a06dee1 100644 --- a/src/services/AppStore.ts +++ b/src/services/AppStore.ts @@ -74,7 +74,7 @@ export class AppStore { MenuStore.updateOnHistory(history.currentId, this.scroll); this.spec = new SpecStore(spec, specUrl, this.options); - this.menu = new MenuStore(this.spec, this.scroll, history); + this.menu = new MenuStore(this.spec, this.scroll, history, this.options); if (!this.options.disableSearch) { this.search = new SearchStore(); diff --git a/src/services/MenuStore.ts b/src/services/MenuStore.ts index f775070b..6f7a8c30 100644 --- a/src/services/MenuStore.ts +++ b/src/services/MenuStore.ts @@ -7,6 +7,7 @@ import { ScrollService } from './ScrollService'; import { flattenByProp, SECURITY_SCHEMES_SECTION_PREFIX } from '../utils'; import { GROUP_DEPTH } from './MenuBuilder'; +import { RedocNormalizedOptions } from "./RedocNormalizedOptions"; export type MenuItemGroupType = 'group' | 'tag' | 'section'; export type MenuItemType = MenuItemGroupType | 'operation'; @@ -75,7 +76,12 @@ export class MenuStore { * @param spec [SpecStore](#SpecStore) which contains page content structure * @param scroll scroll service instance used by this menu */ - constructor(spec: SpecStore, public scroll: ScrollService, public history: HistoryService) { + constructor( + spec: SpecStore, + public scroll: ScrollService, + public history: HistoryService, + public options: RedocNormalizedOptions + ) { this.items = spec.contentItems; this.flatItems = flattenByProp(this.items || [], 'items'); @@ -197,7 +203,7 @@ export class MenuStore { // do not allow activating group items // TODO: control over options - if (item.depth <= GROUP_DEPTH) { + if (item.depth <= GROUP_DEPTH && !this.options.collapseTagGroups) { return; }