]> BookStack Code Mirror - bookstack/commitdiff
Updated editor usability on mobile
authorDan Brown <redacted>
Sat, 13 Apr 2019 17:30:11 +0000 (18:30 +0100)
committerDan Brown <redacted>
Sat, 13 Apr 2019 17:30:11 +0000 (18:30 +0100)
resources/assets/js/components/wysiwyg-editor.js
resources/assets/sass/_header.scss
resources/assets/sass/_pages.scss
resources/assets/sass/_tinymce.scss
resources/views/pages/form.blade.php

index 2767d35c0f80cdf4a68af9a4ad3924080a3b7b89..ce5cfbf4e66c9fe990cb2fe86bc21d8a5c0f2214 100644 (file)
@@ -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));
+
             }
         };
     }
index cbd85fd25751c1b1efaae67c5b95887a922a33d6..00b79180309d1887d4f55a1dbfdc1c8836246f82 100644 (file)
@@ -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;
index 7cc9647a1999084fff2033803caa8027d7fb7484..cda310caf52c91c6e3cc5f716410ee54fc8a944f 100755 (executable)
   }
 }
 
+@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);
index c758619d693c0d68533443104e2aa33eb1d58615..2dbf6916430c5e9485e17bfeb33b191d0aa0d460 100644 (file)
   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;
index 4a55d4471916f2ee62f8a447e382252a39f38c76..29096fc8eb421f748050511414c15e1fdf2ba1bc 100644 (file)
     {{ csrf_field() }}
 
     {{--Header Bar--}}
-    <div class="primary-background-light toolbar">
+    <div class="primary-background-light toolbar page-edit-toolbar">
         <div class="grid third v-center">
 
             <div class="action-buttons text-left px-m py-xs">
-                <a href="{{ back()->getTargetUrl() }}" class="text-button text-primary">@icon('back'){{ trans('common.back') }}</a>
-                <a onclick="$('body>header').slideToggle();" class="text-button text-primary">@icon('swap-vertical'){{ trans('entities.pages_edit_toggle_header') }}</a>
+                <a href="{{ back()->getTargetUrl() }}" class="text-button text-primary">@icon('back')<span class="hide-under-l">{{ trans('common.back') }}</span></a>
+                <a onclick="$('body>header').slideToggle();" class="text-button text-primary">@icon('swap-vertical')<span class="hide-under-l">{{ trans('entities.pages_edit_toggle_header') }}</span></a>
             </div>
 
             <div class="text-center px-m py-xs">
@@ -48,7 +48,7 @@
                     </ul>
                 </div>
 
-                <button type="submit" id="save-button" class="text-button text-pos-hover">@icon('save'){{ trans('entities.pages_save') }}</button>
+                <button type="submit" id="save-button" class="float-left text-primary text-button text-pos-hover">@icon('save')<span>{{ trans('entities.pages_save') }}</span></button>
             </div>
         </div>
     </div>