X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/e711290d8b1ce06b38e0560248806e8de2077870..refs/heads/development:/resources/js/components/expand-toggle.js diff --git a/resources/js/components/expand-toggle.js b/resources/js/components/expand-toggle.js index 76928623d..29173a058 100644 --- a/resources/js/components/expand-toggle.js +++ b/resources/js/components/expand-toggle.js @@ -1,9 +1,9 @@ -import {slideUp, slideDown} from '../services/animations'; +import {slideUp, slideDown} from '../services/animations.ts'; import {Component} from './component'; export class ExpandToggle extends Component { - setup(elem) { + setup() { this.targetSelector = this.$opts.targetSelector; this.isOpen = this.$opts.isOpen === 'true'; this.updateEndpoint = this.$opts.updateEndpoint; @@ -25,7 +25,8 @@ export class ExpandToggle extends Component { const matchingElems = document.querySelectorAll(this.targetSelector); for (const match of matchingElems) { - this.isOpen ? this.close(match) : this.open(match); + const action = this.isOpen ? this.close : this.open; + action(match); } this.isOpen = !this.isOpen;