X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/f467185e8610eb0e06482f665b07d2a3f3def9af..4e49d06182d09ac30ef4fcafd5924bb6d42a8853:/resources/assets/js/components/markdown-editor.js diff --git a/resources/assets/js/components/markdown-editor.js b/resources/assets/js/components/markdown-editor.js index b8e2bc040..55cf67813 100644 --- a/resources/assets/js/components/markdown-editor.js +++ b/resources/assets/js/components/markdown-editor.js @@ -64,13 +64,26 @@ class MarkdownEditor { let action = button.getAttribute('data-action'); if (action === 'insertImage') this.actionInsertImage(); if (action === 'insertLink') this.actionShowLinkSelector(); - if (action === 'insertDrawing' && event.ctrlKey) { + if (action === 'insertDrawing' && (event.ctrlKey || event.metaKey)) { this.actionShowImageManager(); return; } if (action === 'insertDrawing') this.actionStartDrawing(); }); + // Mobile section toggling + this.elem.addEventListener('click', event => { + const toolbarLabel = event.target.closest('.editor-toolbar-label'); + if (!toolbarLabel) return; + + const currentActiveSections = this.elem.querySelectorAll('.markdown-editor-wrap'); + for (let activeElem of currentActiveSections) { + activeElem.classList.remove('active'); + } + + toolbarLabel.closest('.markdown-editor-wrap').classList.add('active'); + }); + window.$events.listen('editor-markdown-update', value => { this.cm.setValue(value); this.updateAndRender();