Browse Source

enhance(mobile): disable right sidebar

leizhe 4 years ago
parent
commit
6e796aea5d
1 changed files with 12 additions and 9 deletions
  1. 12 9
      src/main/frontend/state.cljs

+ 12 - 9
src/main/frontend/state.cljs

@@ -15,7 +15,8 @@
             [medley.core :as medley]
             [promesa.core :as p]
             [rum.core :as rum]
-            [frontend.mobile.util :as mobile]))
+            [frontend.mobile.util :as mobile]
+            [frontend.mobile.util :as mobile-util]))
 
 (defonce state
   (let [document-mode? (or (storage/get :document/mode?) false)
@@ -771,14 +772,16 @@
 
 (defn sidebar-add-block!
   [repo db-id block-type block-data]
-  (when db-id
-    (update-state! :sidebar/blocks (fn [blocks]
-                                     (->> (remove #(= (second %) db-id) blocks)
-                                          (cons [repo db-id block-type block-data])
-                                          (distinct))))
-    (open-right-sidebar!)
-    (when-let [elem (gdom/getElementByClass "cp__right-sidebar-scrollable")]
-      (util/scroll-to elem 0))))
+  (when-not (or (util/mobile?)
+            (mobile-util/is-native-platform?))
+   (when db-id
+     (update-state! :sidebar/blocks (fn [blocks]
+                                      (->> (remove #(= (second %) db-id) blocks)
+                                           (cons [repo db-id block-type block-data])
+                                           (distinct))))
+     (open-right-sidebar!)
+     (when-let [elem (gdom/getElementByClass "cp__right-sidebar-scrollable")]
+       (util/scroll-to elem 0)))))
 
 (defn sidebar-remove-block!
   [idx]