Просмотр исходного кода

fix(mobile): clicking icon and properties shouldn't redirect page

Tienson Qin 1 неделя назад
Родитель
Сommit
9cfb7f0b2e

+ 9 - 5
src/main/frontend/components/block.cljs

@@ -2439,11 +2439,15 @@
                                             "Hide query"
                                             "Set query")]))]
     [:div
-     {:class (if query?
-               "inline-flex"
-               "w-full inline")
-      :on-mouse-over #(set-hover? true)
-      :on-mouse-out #(set-hover? false)}
+     (merge
+      {:class (if query?
+                "inline-flex"
+                "w-full inline")
+       :on-mouse-over #(set-hover? true)
+       :on-mouse-out #(set-hover? false)}
+      (when-let [on-title-click (:on-title-click config)]
+        (when (fn? on-title-click)
+          {:on-click on-title-click})))
      (cond
        (and query? (and blank? (or advanced-query? show-query?)))
        [:span.opacity-75.hover:opacity-100 "Untitled query"]

+ 13 - 16
src/main/frontend/components/page.cljs

@@ -458,21 +458,7 @@
       :on-pointer-down (fn [e]
                          (when (util/right-click? e)
                            (state/set-state! :page-title/context {:page (:block/title page)
-                                                                  :page-entity page})))
-      :on-click (fn [e]
-                  (when-not (some-> e (.-target) (.closest ".ls-properties-area"))
-                    (when-not (= (.-nodeName (.-target e)) "INPUT")
-                      (.preventDefault e)
-                      (cond
-                        (gobj/get e "shiftKey")
-                        (state/sidebar-add-block!
-                         (state/get-current-repo)
-                         (:db/id page)
-                         :page)
-                        (and (util/mobile?) journals?)
-                        (route-handler/redirect-to-page! (:block/uuid page))
-                        :else
-                        nil))))}
+                                                                  :page-entity page})))}
 
      [:div.w-full.relative
       (component-block/block-container
@@ -488,7 +474,18 @@
         :hide-children? true
         :container-id container-id
         :show-tag-and-property-classes? true
-        :journal-page? (ldb/journal? page)}
+        :journal-page? (ldb/journal? page)
+        :on-title-click (fn [e]
+                          (cond
+                            (gobj/get e "shiftKey")
+                            (state/sidebar-add-block!
+                             (state/get-current-repo)
+                             (:db/id page)
+                             :page)
+                            (and (util/mobile?) journals?)
+                            (route-handler/redirect-to-page! (:block/uuid page))
+                            :else
+                            nil))}
        page)]]))
 
 (defn- page-mouse-over

+ 5 - 2
src/main/mobile/components/popup.cljs

@@ -30,9 +30,12 @@
         (.present
          plugin
          (clj->js
-          (let [height (popup-min-height (:default-height opts))]
+          (let [height (popup-min-height (:default-height opts))
+                height' (if (contains? #{:ls-icon-picker} id)
+                          760
+                          height)]
             (cond-> {:allowFullHeight (not= (:type opts) :action-sheet)}
-              (int? height) (assoc :defaultHeight height)))))))))
+              (int? height') (assoc :defaultHeight height')))))))))
 
 (defn- dismiss-native-sheet!
   []