X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9135a85de4eef32a91c7a3ee0aa405ed454e5a4c..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 a581ae7b4..ddb4ff39c 100644 --- a/resources/js/components/editor-toolbox.js +++ b/resources/js/components/editor-toolbox.js @@ -1,4 +1,4 @@ -import {Component} from "./component"; +import {Component} from './component'; export class EditorToolbox extends Component { @@ -8,6 +8,7 @@ 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(); @@ -30,16 +31,16 @@ 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) { - // Set button visibility for (const button of this.buttons) { button.classList.remove('active'); - const bName = button.dataset.tab; + const bName = button.dataset.tab; if (bName === tabName) button.classList.add('active'); } @@ -55,4 +56,4 @@ export class EditorToolbox extends Component { } } -} \ No newline at end of file +}