mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-09 22:54:51 +03:00
fix: update collapseAll method
to avoid collapsing whole object/array
This commit is contained in:
parent
afc7a95f13
commit
9d7249e4bc
|
@ -57,11 +57,10 @@ class Json extends React.PureComponent<JsonProps> {
|
|||
|
||||
collapseAll = () => {
|
||||
const elements = this.node.getElementsByClassName('collapsible');
|
||||
for (const expanded of Array.prototype.slice.call(elements)) {
|
||||
// const collapsed = elements[i];
|
||||
if ((expanded.parentNode as Element)!.classList.contains('redoc-json')) {
|
||||
continue;
|
||||
}
|
||||
// skip first item to avoid collapsing whole object/array
|
||||
const elementsArr = Array.prototype.slice.call(elements).slice(1);
|
||||
|
||||
for (const expanded of elementsArr) {
|
||||
(expanded.parentNode as Element)!.classList.add('collapsed');
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user