Bladeren bron

Merge pull request #5557 from logseq/fix-toolbar-showing

Fix: toolbar not showing when using Apple Pencil and external keyboard on iPad
Tienson Qin 3 jaren geleden
bovenliggende
commit
ceee6d940c
2 gewijzigde bestanden met toevoegingen van 18 en 17 verwijderingen
  1. 2 1
      src/main/frontend/mobile/footer.cljs
  2. 16 16
      src/main/frontend/mobile/mobile_bar.cljs

+ 2 - 1
src/main/frontend/mobile/footer.cljs

@@ -50,7 +50,8 @@
 
 (rum/defc footer < rum/reactive
   []
-  (when (and (state/sub :mobile/show-tabbar?)
+  (when (and (not (state/sub :editor/editing?))
+             (state/sub :mobile/show-tabbar?)
              (state/get-current-repo))
     [:div.cp__footer.w-full.bottom-0.justify-between
      (audio-record-cp)

+ 16 - 16
src/main/frontend/mobile/mobile_bar.cljs

@@ -7,6 +7,7 @@
             [frontend.handler.history :as history]
             [frontend.handler.page :as page-handler]
             [frontend.mobile.camera :as mobile-camera]
+            [frontend.mobile.util :as mobile-util]
             [frontend.state :as state]
             [frontend.ui :as ui]
             [frontend.util :as util]
@@ -107,25 +108,24 @@
 
 (rum/defc mobile-bar < rum/reactive
   []
-  (when (and (state/sub :mobile/toolbar-update-observer)
-             (state/sub :mobile/show-toolbar?))
+  (when (and (state/sub :editor/editing?)
+             (or (state/sub :mobile/show-toolbar?)
+                 (mobile-util/native-ipad?))
+             (state/sub :mobile/toolbar-update-observer))
     (when-let [config-toolbar-stats (:mobile/toolbar-stats (state/get-config))]
-      (prn :config-toolbar-stats config-toolbar-stats)
       (reset! commands-stats config-toolbar-stats))
     (let [parent-id (state/get-edit-input-id)
           commands (commands parent-id)
           sorted-commands (sort-by (comp :counts second) > @commands-stats)]
-      (when (and (state/sub :mobile/show-toolbar?)
-                 (state/sub :editor/editing?))
-        [:div#mobile-editor-toolbar.bg-base-2
-         [:div.toolbar-commands
-          (command (editor-handler/move-up-down true) "arrow-bar-to-up")
-          (command (editor-handler/move-up-down false) "arrow-bar-to-down")
-          (command #(if (state/sub :document/mode?)
-                      (editor-handler/insert-new-block! nil)
-                      (commands/simple-insert! parent-id "\n" {})) "arrow-back")
-          (for [command sorted-commands]
-            ((first command) commands))]
-         [:div.toolbar-hide-keyboard
-          (command #(state/clear-edit!) "keyboard-show")]]))))
+      [:div#mobile-editor-toolbar.bg-base-2
+       [:div.toolbar-commands
+        (command (editor-handler/move-up-down true) "arrow-bar-to-up")
+        (command (editor-handler/move-up-down false) "arrow-bar-to-down")
+        (command #(if (state/sub :document/mode?)
+                    (editor-handler/insert-new-block! nil)
+                    (commands/simple-insert! parent-id "\n" {})) "arrow-back")
+        (for [command sorted-commands]
+          ((first command) commands))]
+       [:div.toolbar-hide-keyboard
+        (command #(state/clear-edit!) "keyboard-show")]])))