Przeglądaj źródła

feat(gesture): switch outdent and more icon

llcc 3 lat temu
rodzic
commit
c03ad5a781

+ 2 - 2
src/main/frontend/components/block.cljs

@@ -2094,8 +2094,8 @@
   [:div.block-right-menu.flex.bg-base-2.rounded-md.ml-1
    [:div.commands-button.w-0.flex.flew-col.rounded-md
     {:id (str "block-right-menu-" uuid)}
-    [:div.outdent (ui/icon "indent-decrease" {:style {:fontSize 16}})]
-    [:div.more (ui/icon "dots-circle-horizontal" {:style {:fontSize 16}})]]])
+    [:div.more (ui/icon "dots-circle-horizontal" {:style {:fontSize 16}})]
+    [:div.outdent (ui/icon "indent-decrease" {:style {:fontSize 16}})]]])
 
 (rum/defcs block-content-or-editor < rum/reactive
   (rum/local true :hide-block-refs?)

+ 19 - 16
src/main/frontend/handler/block.cljs

@@ -187,7 +187,7 @@
                      (> (. js/Math abs dx) 10))
             (let [left (gdom/getElement (str "block-left-menu-" uuid))
                   right (gdom/getElement (str "block-right-menu-" uuid))]
-              
+
               (cond
                 (= direction :right)
                 (do
@@ -197,7 +197,7 @@
                       (set! (.. left -style -width) (str dx "px")))
                     (when (< dx 0)
                       (set! (.. left -style -width) (str (max (+ 50 dx) 0) "px")))
-                    
+
                     (let [indent (gdom/getFirstElementChild left)]
                       (when (indentable? block)
                         (if (>= (.-clientWidth left) 50)
@@ -215,15 +215,18 @@
 
                     (let [outdent (gdom/getFirstElementChild right)
                           more (gdom/getLastElementChild right)]
-                      (when (outdentable? block)
-                        (if (and (>= (.-clientWidth right) 40)
-                                 (< (.-clientWidth right) 80))
-                          (set! (.. outdent -style -opacity) "100%")
-                          (set! (.. outdent -style -opacity) "30%")))
+                      (if (and (>= (.-clientWidth right) 40)
+                               (< (.-clientWidth right) 80))
+                        (set! (.. outdent -style -opacity) "100%")
+                        (set! (.. outdent -style -opacity) "30%"))
 
-                      (if (>= (.-clientWidth right) 80)
-                        (set! (.. more -style -opacity) "100%")
-                        (set! (.. more -style -opacity) "30%")))))
+                      (when (outdentable? block)
+                        (if (>= (.-clientWidth right) 80)
+                          (set! (.. more -style -opacity) "100%")
+                          (set! (.. more -style -opacity) "30%") 
+                        ;; (set! (.. outdent -style -opacity) "100%")
+                          ;; (set! (.. outdent -style -opacity) "30%")
+                        )))))
                 :else
                 nil))))))))
 
@@ -244,18 +247,18 @@
                 :light))
 
             (and right-menu (< 40 (.-clientWidth right-menu) 80))
-            (when (outdentable? block)
-              (haptics/with-haptics-impact
-                (indent-outdent-block! block :left)
-                :light))
-
-            (and right-menu (>= (.-clientWidth right-menu) 80))
             (haptics/with-haptics-impact
               (do (state/set-state! :mobile/show-action-bar? true)
                   (state/set-state! :mobile/actioned-block block)
                   (select-block! uuid))
               :light)
 
+            (and right-menu (>= (.-clientWidth right-menu) 80))
+            (when (outdentable? block)
+              (haptics/with-haptics-impact
+                (indent-outdent-block! block :left)
+                :light))
+
             :else
             nil))
         (catch js/Error e