@knowcode/doc-builder 1.10.8 → 1.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/js/main.js +19 -12
- package/package.json +1 -1
package/assets/js/main.js
CHANGED
|
@@ -1090,22 +1090,29 @@ function initCollapsibleNavigation() {
|
|
|
1090
1090
|
|
|
1091
1091
|
if (content) {
|
|
1092
1092
|
const isExpanded = title.classList.contains('expanded');
|
|
1093
|
-
|
|
1093
|
+
|
|
1094
1094
|
if (isExpanded) {
|
|
1095
1095
|
// Collapse this section
|
|
1096
1096
|
title.classList.remove('expanded');
|
|
1097
1097
|
content.classList.add('collapsed');
|
|
1098
|
-
|
|
1099
|
-
//
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1098
|
+
|
|
1099
|
+
// Recursively collapse ALL nested submenus
|
|
1100
|
+
const collapseAllNested = (parentContent) => {
|
|
1101
|
+
const childSections = parentContent.querySelectorAll('.nav-title.collapsible');
|
|
1102
|
+
childSections.forEach(childTitle => {
|
|
1103
|
+
const childTargetId = childTitle.getAttribute('data-target');
|
|
1104
|
+
const childContent = document.getElementById(childTargetId);
|
|
1105
|
+
if (childContent) {
|
|
1106
|
+
childTitle.classList.remove('expanded');
|
|
1107
|
+
childContent.classList.add('collapsed');
|
|
1108
|
+
// Recursively collapse any nested children
|
|
1109
|
+
collapseAllNested(childContent);
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
};
|
|
1113
|
+
|
|
1114
|
+
// Collapse all nested content
|
|
1115
|
+
collapseAllNested(content);
|
|
1109
1116
|
} else {
|
|
1110
1117
|
// Expand this section
|
|
1111
1118
|
title.classList.add('expanded');
|