1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-09-10 17:31:58 +03:00

Auto-expand collapsible sections if containing error

For #1693
This commit is contained in:
Dan Brown
2019-12-16 13:27:17 +00:00
parent a9634b6b66
commit b93f8a4d46

View File

@@ -12,8 +12,8 @@ class Collapsible {
this.content = elem.querySelector('[collapsible-content]'); this.content = elem.querySelector('[collapsible-content]');
if (!this.trigger) return; if (!this.trigger) return;
this.trigger.addEventListener('click', this.toggle.bind(this)); this.trigger.addEventListener('click', this.toggle.bind(this));
this.openIfContainsError();
} }
open() { open() {
@@ -36,6 +36,13 @@ class Collapsible {
} }
} }
openIfContainsError() {
const error = this.content.querySelector('.text-neg');
if (error) {
this.open();
}
}
} }
export default Collapsible; export default Collapsible;