striven-editor

Maintained and contributed to an open source WYSIWYG editor as an internship project that made it to production and was adopted by the company I was working at.
git clone https://unitehenry.com/git/striven-editor.git
Log | Files | Refs | README | LICENSE

commit 9ae4347da80d0f3b77e29114ddc0e93f93f34f17
parent 43ea5315b286632feafe28a0cb323881205f7ff5
Author: unitehenry <unitehenry@gmail.com>
Date:   Fri,  1 Nov 2019 15:33:01 -0400

popup minimal responsive menu

Diffstat:
Msrc/striveneditor.css | 6------
Msrc/striveneditor.js | 27++++++++++-----------------
2 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/src/striveneditor.css b/src/striveneditor.css @@ -127,12 +127,6 @@ justify-content: flex-end; } -@media (max-width: 700px) { - .striven-editor .se-toolbar-group-minimal { - border: 1px solid #ddd; - } -} - /** Toolbar Menu **/ .striven-editor .se-toolbar-menu { diff --git a/src/striveneditor.js b/src/striveneditor.js @@ -1006,34 +1006,27 @@ export default class StrivenEditor { const textDecorationMenu = that.toolbar.querySelector('#menu-textDecoration'); const textDecorationGroup = that.toolbar.querySelector('#group-textDecoration'); - textDecorationMenu.style.display = responsive ? 'inline-block' : 'none'; - textDecorationGroup.style.display = responsive ? 'none' : 'inline-block'; - textDecorationMenu.onclick = () => { let isOpen = (textDecorationMenu.dataset.open === 'true'); textDecorationMenu.dataset.open = (isOpen ? 'false' : 'true'); isOpen = (textDecorationMenu.dataset.open === 'true'); if (responsive) { - textDecorationGroup.style.position = isOpen ? 'absolute' : 'relative'; - textDecorationGroup.style.display = isOpen ? 'block' : 'none'; + if (isOpen) { + textDecorationGroup.classList.add('se-popup-open'); + } else { + textDecorationGroup.classList.remove('se-popup-open'); + } } } if (responsive) { - textDecorationGroup.classList.add('se-toolbar-group-minimal'); - !that.options.toolbarBottom && (textDecorationGroup.style.top = '50px'); - that.options.toolbarBottom && (textDecorationGroup.style.bottom = '50px'); - textDecorationGroup.style.left = '10px'; + textDecorationMenu.style.display = 'inline-block'; + textDecorationGroup.classList.add('se-popup'); + textDecorationGroup.classList.add(that.options.toolbarBottom ? 'se-popup-bottom' : 'se-popup-top'); } else { - textDecorationGroup.classList.remove('se-toolbar-group-minimal'); - - textDecorationGroup.style.position = 'relative'; - textDecorationGroup.style.display = 'inline-block'; - - !that.options.toolbarBottom && (textDecorationGroup.style.top = '0px'); - that.options.toolbarBottom && (textDecorationGroup.style.bottom = '0px'); - textDecorationGroup.style.left = '0px'; + textDecorationMenu.style.display = 'none'; + textDecorationGroup.classList.remove('se-popup'); } }