浏览代码

only update toolbar when keyboard re-displays

llcc 3 年之前
父节点
当前提交
961fde743e
共有 2 个文件被更改,包括 3 次插入9 次删除
  1. 2 5
      src/main/frontend/mobile/mobile_bar.cljs
  2. 1 4
      src/main/frontend/state.cljs

+ 2 - 5
src/main/frontend/mobile/mobile_bar.cljs

@@ -49,8 +49,7 @@
                         (set-command-stats icon))
                       (if event?
                         (command-handler e)
-                        (command-handler))
-                      (state/set-state! :mobile/toolbar-update-observer (rand-int 1000000)))}
+                        (command-handler)))}
     (ui/icon icon {:style {:fontSize ui/icon-size}})]])
 
 (rum/defc timestamp-submenu
@@ -70,7 +69,6 @@
       {:on-mouse-down (fn [event]
                         (util/stop event)
                         (set-command-stats :calendar)
-                        (state/set-state! :mobile/toolbar-update-observer (rand-int 1000000))
                         (let [target (gdom/getNextElementSibling (.-target event))]
                           (dom/add-class! target "show-submenu")))}
       (ui/icon "calendar" {:style {:fontSize ui/icon-size}})
@@ -118,8 +116,7 @@
   []
   (when (and (state/sub :editor/editing?)
              (or (state/sub :mobile/show-toolbar?)
-                 (mobile-util/native-ipad?))
-             (state/sub :mobile/toolbar-update-observer))
+                 (mobile-util/native-ipad?)))
     (when-let [config-toolbar-stats (:mobile/toolbar-stats (state/get-config))]
       (reset! commands-stats config-toolbar-stats))
     (let [parent-id (state/get-edit-input-id)

+ 1 - 4
src/main/frontend/state.cljs

@@ -148,11 +148,8 @@
      :mobile/actioned-block                 nil
      :mobile/show-toolbar?                  false
      :mobile/show-recording-bar?            false
-     ;;; toolbar icon doesn't update correctly when clicking after separate it from box,
-     ;;; add a random in (<= 1000000) to observer its update
-     :mobile/toolbar-update-observer        0
      :mobile/show-tabbar?                   false
-
+     
      ;; plugin
      :plugin/enabled                        (and (util/electron?)
                                                  ;; true false :theme-only