فهرست منبع

chore: remove image placeholder

Tienson Qin 7 ماه پیش
والد
کامیت
f8488892f4
1فایلهای تغییر یافته به همراه8 افزوده شده و 9 حذف شده
  1. 8 9
      src/main/frontend/components/block.cljs

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

@@ -381,6 +381,7 @@
                             (js/window.apis.openExternal image-src)))}
              (shui/tabler-icon "folder-pin")])]])])])
 
+;; TODO: store image height and width for better ux
 (rum/defcs ^:large-vars/cleanup-todo resizable-image <
   (rum/local nil ::size)
   {:will-unmount (fn [state]
@@ -393,10 +394,12 @@
         width (or (get-in asset-block [:logseq.property.asset/resize-metadata :width])
                   (:width metadata))
         *width (get state ::size)
-        width (or @*width width 500)
+        width (or @*width width 250)
         metadata' (merge
-                   {:width width
-                    :height 125}
+                   (cond->
+                    {:height 125}
+                     width
+                     (assoc :width width))
                    metadata)
         resizable? (and (not (mobile-util/native-platform?))
                         (not breadcrumb?)
@@ -1068,16 +1071,12 @@
         repo (state/get-current-repo)
         asset-file-write-finished? (state/sub :assets/asset-file-write-finish
                                               {:path-in-sub-atom [repo (str (:block/uuid block))]})]
-    (cond
-      (or file-exists? asset-file-write-finished?)
+    (when (or file-exists? asset-file-write-finished?)
       (asset-link (assoc config :asset-block block)
                   (:block/title block)
                   (path/path-join (str "../" common-config/local-assets-dir) file)
                   nil
-                  nil)
-
-      :else
-      (shui/skeleton {:class "h-[125px] w-[250px] rounded-xl"}))))
+                  nil))))
 
 (defn- img-audio-video?
   [block]