mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-25 18:13:44 +03:00
fix: do not collapse top level on Collapse All in json samples (#1209)
* fix: update collapseAll method to avoid collapsing whole object/array * fix: remove extra "slice()" call
This commit is contained in:
parent
c6eaa0281b
commit
830371b5d1
|
@ -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, 1);
|
||||
|
||||
for (const expanded of elementsArr) {
|
||||
(expanded.parentNode as Element)!.classList.add('collapsed');
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user