X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/e36cdaad0d56280aec7cd02c0c78e77dc0c4d9a1..refs/pull/5429/head:/resources/js/components/editor-toolbox.js diff --git a/resources/js/components/editor-toolbox.js b/resources/js/components/editor-toolbox.js index 1f1fce9dc..ddb4ff39c 100644 --- a/resources/js/components/editor-toolbox.js +++ b/resources/js/components/editor-toolbox.js @@ -8,15 +8,12 @@ export class EditorToolbox extends Component { this.buttons = this.$manyRefs.tabButton; this.contentElements = this.$manyRefs.tabContent; this.toggleButton = this.$refs.toggle; + this.editorWrapEl = this.container.closest('.page-editor'); this.setupListeners(); // Set the first tab as active on load this.setActiveTab(this.contentElements[0].dataset.tabContent); - - setTimeout(() => { - this.setActiveTab('files', true); - }, 500); } setupListeners() { @@ -34,8 +31,9 @@ export class EditorToolbox extends Component { toggle() { this.container.classList.toggle('open'); - const expanded = this.container.classList.contains('open') ? 'true' : 'false'; - this.toggleButton.setAttribute('aria-expanded', expanded); + const isOpen = this.container.classList.contains('open'); + this.toggleButton.setAttribute('aria-expanded', isOpen ? 'true' : 'false'); + this.editorWrapEl.classList.toggle('toolbox-open', isOpen); } setActiveTab(tabName, openToolbox = false) {