浏览代码

enhance(ux): improve ux for the new property dialog input

charlie 1 年之前
父节点
当前提交
19bc7aa691

+ 4 - 2
src/main/frontend/components/property/dialog.cljs

@@ -1,10 +1,12 @@
 (ns frontend.components.property.dialog
   "Property && value choose"
-  (:require [rum.core :as rum]
-            [frontend.components.property :as property-component]
+  (:require [frontend.components.property :as property-component]
+            [rum.core :as rum]
+            [frontend.modules.shortcut.core :as shortcut]
             [logseq.db :as ldb]))
 
 (rum/defcs dialog <
+  shortcut/disable-all-shortcuts
   (rum/local nil ::property-value)
   {:init (fn [state]
            (assoc state ::property-key (atom (:property-key (last (:rum/args state))))))}

+ 4 - 1
src/main/frontend/components/property/value.cljs

@@ -161,8 +161,11 @@
     (rum/use-effect!
      (fn []
        (when editing?
-         (.click (rum/deref *trigger-ref))))
+         (js/setTimeout
+           #(some-> (rum/deref *trigger-ref)
+              (.click)) 32)))
      [editing?])
+
     (if multiple-values?
       (shui/button
        {:class "jtrigger h-6 empty-btn"

+ 1 - 0
src/main/frontend/handler/events.cljs

@@ -976,6 +976,7 @@
        (shui/dialog-open! #(property-dialog/dialog blocks (assoc opts :in-block-container? in-block-container?))
                           {:id :property-dialog
                            :align "start"
+                           :content-props {:onOpenAutoFocus #(.preventDefault %)}
                            :on-close (fn [_id]
                                        (when (and (not (state/editing?)) editing-block
                                                   ;; block not changed