Explorar el Código

fix: clear selection when swipe to toggle a selected block

Tienson Qin hace 5 meses
padre
commit
ecaf7fc0ae
Se han modificado 2 ficheros con 5 adiciones y 5 borrados
  1. 4 4
      src/main/frontend/handler/block.cljs
  2. 1 1
      src/main/frontend/state.cljs

+ 4 - 4
src/main/frontend/handler/block.cljs

@@ -360,15 +360,15 @@
         (when (or select? swiped?)
           (dom/set-style! block-container :transform "translateX(0)")
           (when select?
-            (if (contains? (set (state/get-selection-blocks)) block-container)
+            (if (contains? (set (state/get-selection-block-ids)) (some-> (.getAttribute block-container "blockid") uuid))
               (state/drop-selection-block! block-container)
               (do
                 (state/clear-edit!)
                 (state/conj-selection-block! block-container nil)))
-            (when (seq (state/get-selection-blocks))
+            (if (seq (state/get-selection-blocks))
               (state/set-state! :mobile/show-action-bar? true)
-              ;; (state/set-state! :mobile/actioned-block )
-              )
+              (when (:mobile/show-action-bar? @state/state)
+                (state/set-state! :mobile/show-action-bar? false)))
             (haptics/haptics)))
         (reset! *swiped? false)
         (catch :default e

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

@@ -1271,7 +1271,7 @@ Similar to re-frame subscriptions"
 
 (defn drop-selection-block!
   [block]
-  (set-selection-blocks-aux! (-> (remove #(= block %) (get-unsorted-selection-blocks))
+  (set-selection-blocks-aux! (-> (remove #(= (.-id block) (.-id %)) (get-unsorted-selection-blocks))
                                  vec)))
 
 (defn drop-selection-blocks-starts-with!