mirror of
https://github.com/Redocly/redoc.git
synced 2025-03-03 17:35:46 +03:00
refactor: add type heading to menu items
This commit is contained in:
parent
c77e1a28f7
commit
1a29784200
|
@ -104,7 +104,7 @@ export class MenuService {
|
||||||
|
|
||||||
// check if previous items§ can be enabled
|
// check if previous items§ can be enabled
|
||||||
let prevItem = this.flatItems[idx -= 1];
|
let prevItem = this.flatItems[idx -= 1];
|
||||||
while(prevItem && (!prevItem.metadata || !prevItem.items)) {
|
while(prevItem && (!prevItem.metadata || prevItem.metadata.type === 'heading' || !prevItem.items)) {
|
||||||
prevItem.ready = true;
|
prevItem.ready = true;
|
||||||
prevItem = this.flatItems[idx -= 1];
|
prevItem = this.flatItems[idx -= 1];
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ export class MenuService {
|
||||||
// We only need to go up the chain for operations that
|
// We only need to go up the chain for operations that
|
||||||
// might have multiple tags. For headers/subheaders
|
// might have multiple tags. For headers/subheaders
|
||||||
// we need to siply early terminate.
|
// we need to siply early terminate.
|
||||||
if (!currentItem.metadata) {
|
if (!currentItem.metadata || currentItem.metadata.type === 'heading') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,10 @@ export class MenuService {
|
||||||
let item = {
|
let item = {
|
||||||
name: heading.title,
|
name: heading.title,
|
||||||
id: id,
|
id: id,
|
||||||
items: null
|
items: null,
|
||||||
|
metadata: {
|
||||||
|
type: 'heading'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
item.items = this.getMarkdownSubheaders(item, heading);
|
item.items = this.getMarkdownSubheaders(item, heading);
|
||||||
|
|
||||||
|
@ -309,7 +312,10 @@ export class MenuService {
|
||||||
let subItem = {
|
let subItem = {
|
||||||
name: heading.title,
|
name: heading.title,
|
||||||
id: id,
|
id: id,
|
||||||
parent: parent
|
parent: parent,
|
||||||
|
metadata: {
|
||||||
|
type: 'heading'
|
||||||
|
}
|
||||||
};
|
};
|
||||||
res.push(subItem);
|
res.push(subItem);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user