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