From 21e1123d125148c165719c6629b41db1b75feb86 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 13 Apr 2019 18:30:11 +0100 Subject: [PATCH] Updated editor usability on mobile --- .../assets/js/components/wysiwyg-editor.js | 11 +++++++ resources/assets/sass/_header.scss | 15 --------- resources/assets/sass/_pages.scss | 33 +++++++++++++++++++ resources/assets/sass/_tinymce.scss | 7 ++++ resources/views/pages/form.blade.php | 8 ++--- 5 files changed, 55 insertions(+), 19 deletions(-) diff --git a/resources/assets/js/components/wysiwyg-editor.js b/resources/assets/js/components/wysiwyg-editor.js index 2767d35c0..ce5cfbf4e 100644 --- a/resources/assets/js/components/wysiwyg-editor.js +++ b/resources/assets/js/components/wysiwyg-editor.js @@ -517,6 +517,16 @@ class WysiwygEditor { if (scrollId) { scrollToText(scrollId); } + + // Override for touch events to allow scroll on mobile + const container = editor.getContainer(); + const toolbarButtons = container.querySelectorAll('.mce-btn'); + for (let button of toolbarButtons) { + button.addEventListener('touchstart', event => { + event.stopPropagation(); + }); + } + window.editor = editor; }); function editorChange() { @@ -600,6 +610,7 @@ class WysiwygEditor { // Paste image-uploads editor.on('paste', event => editorPaste(event, editor, context)); + } }; } diff --git a/resources/assets/sass/_header.scss b/resources/assets/sass/_header.scss index cbd85fd25..00b791803 100644 --- a/resources/assets/sass/_header.scss +++ b/resources/assets/sass/_header.scss @@ -322,21 +322,6 @@ header .search-box { padding: $-s; } -.toolbar { - position: relative; - > .grid > div { - opacity: 0.8; - transition: opacity ease-in-out 120ms; - &:hover { - opacity: 1; - } - } - .text-button { - color: #666; - fill: #666; - } -} - .action-buttons .text-button { display: inline-block; padding: $-xs $-s; diff --git a/resources/assets/sass/_pages.scss b/resources/assets/sass/_pages.scss index 7cc9647a1..cda310caf 100755 --- a/resources/assets/sass/_pages.scss +++ b/resources/assets/sass/_pages.scss @@ -19,6 +19,39 @@ } } +@include smaller-than($l) { + .page-edit-toolbar { + overflow-x: scroll; + overflow-y: visible; + z-index: 4; + } + .page-edit-toolbar .grid.third { + display: block; + white-space: nowrap; + > div { + display: inline-block; + } + } +} + +@include smaller-than($l) { + .page-edit-toolbar #save-button { + position: fixed; + z-index: 30; + background-color: #FFF; + border-radius: 50%; + width: 42px; + height: 42px; + font-size: 16px; + right: $-m; + bottom: $-xs; + box-shadow: $bs-med; + span { + display: none; + } + } +} + .draft-notification { pointer-events: none; transform: scale(0); diff --git a/resources/assets/sass/_tinymce.scss b/resources/assets/sass/_tinymce.scss index c758619d6..2dbf69164 100644 --- a/resources/assets/sass/_tinymce.scss +++ b/resources/assets/sass/_tinymce.scss @@ -21,6 +21,13 @@ text-align: center; } +@include smaller-than($l) { + .mce-container-body.mce-flow-layout { + overflow-x: scroll; + white-space: nowrap; + } +} + .edit-area.flex > div > .mce-tinymce.mce-container.mce-panel { flex: 1 1 auto; display: flex !important; diff --git a/resources/views/pages/form.blade.php b/resources/views/pages/form.blade.php index 4a55d4471..29096fc8e 100644 --- a/resources/views/pages/form.blade.php +++ b/resources/views/pages/form.blade.php @@ -11,12 +11,12 @@ {{ csrf_field() }} {{--Header Bar--}} -
+