ソースを参照

fix: don't create block for invalid number property value

Tienson Qin 7 ヶ月 前
コミット
17496cfbb1

+ 3 - 3
deps/outliner/src/logseq/outliner/property.cljs

@@ -251,9 +251,9 @@
                           (= :logseq.property/empty-placeholder (:db/ident (d/entity @conn v)))))))
       v
       ;; only value-ref-property types should call this
-      (let [v' (if (and number-property? (string? v))
-                 (parse-double v)
-                 v)]
+      (when-let [v' (if (and number-property? (string? v))
+                      (parse-double v)
+                      v)]
         (find-or-create-property-value conn property-id v')))))
 
 (defn- throw-error-if-self-value

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

@@ -1241,7 +1241,9 @@
                                  (set-editing! false))))]
     [:div.ls-number.flex.flex-1.jtrigger
      {:ref *ref
-      :on-click #(set-editing! true)}
+      :on-click #(do
+                   (state/clear-selection!)
+                   (set-editing! true))}
      (if editing?
        (shui/input
         {:ref *input-ref