mirror of
https://github.com/codex-team/codex.docs.git
synced 2025-08-10 07:55:24 +02:00
expand every match
This commit is contained in:
parent
5b668f7fb0
commit
6be524d3aa
1 changed files with 8 additions and 9 deletions
|
@ -209,13 +209,6 @@ export default class SidebarFilter {
|
||||||
element.classList.add(SidebarFilter.CSS.sectionTitleSelected);
|
element.classList.add(SidebarFilter.CSS.sectionTitleSelected);
|
||||||
} else if (type === 'item') {
|
} else if (type === 'item') {
|
||||||
element.classList.add(SidebarFilter.CSS.sectionListItemSlelected);
|
element.classList.add(SidebarFilter.CSS.sectionListItemSlelected);
|
||||||
// close section.
|
|
||||||
const parentSection = element.closest('section');
|
|
||||||
|
|
||||||
// if item is in collapsed section, expand it.
|
|
||||||
if (!parentSection.classList.contains(SidebarFilter.CSS.sectionTitleActive)) {
|
|
||||||
this.setSectionCollapsed(parentSection, false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// scroll to focused title or item.
|
// scroll to focused title or item.
|
||||||
|
@ -334,10 +327,16 @@ export default class SidebarFilter {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!isTitleMatch && !isSingleItemMatch) {
|
if (!isTitleMatch && !isSingleItemMatch) {
|
||||||
// hide section and it's items are not a match.
|
// hide section if it's items are not a match.
|
||||||
section.classList.add(SidebarFilter.CSS.sectionHidden);
|
section.classList.add(SidebarFilter.CSS.sectionHidden);
|
||||||
} else {
|
} else {
|
||||||
// show section and it's items are a match.
|
const parentSection = sectionTitle.closest('section');
|
||||||
|
|
||||||
|
// if item is in collapsed section, expand it.
|
||||||
|
if (!parentSection.classList.contains(SidebarFilter.CSS.sectionTitleActive)) {
|
||||||
|
this.setSectionCollapsed(parentSection, false);
|
||||||
|
}
|
||||||
|
// show section if it's items are a match.
|
||||||
section.classList.remove(SidebarFilter.CSS.sectionHidden);
|
section.classList.remove(SidebarFilter.CSS.sectionHidden);
|
||||||
// add section title to search results.
|
// add section title to search results.
|
||||||
this.searchResults.push({
|
this.searchResults.push({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue