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

Fix: toolbar not showing when using Apple Pencil and external keyboard on iPad
pull/5576/head
Tienson Qin 2022-06-06 18:38:22 +08:00 committed by GitHub
commit ceee6d940c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 17 deletions

View File

@ -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)

View File

@ -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")]])))