Browse Source

enhance(ux): add asset ref link for the highlight area image

charlie 1 year ago
parent
commit
e053405bba

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

@@ -2227,10 +2227,10 @@
                              :dune)))}
 
                       [:span.hl-page
-                       [:strong.forbid-edit (str "P" (or
-                                                      (pu/lookup properties :logseq.property.pdf/hl-page)
-                                                      "?"))]
-                       [:label.blank " "]]
+                       [:strong.forbid-edit
+                        (str "P"
+                          (or (pu/lookup properties :logseq.property.pdf/hl-page)
+                            "?"))]]
 
                       (when (and area?
                                  (or (:hl-stamp properties)

+ 12 - 2
src/main/frontend/extensions/pdf/assets.cljs

@@ -13,6 +13,7 @@
             [frontend.handler.page :as page-handler]
             [frontend.handler.assets :as assets-handler]
             [frontend.handler.notification :as notification]
+            [frontend.handler.route :as route-handler]
             [frontend.handler.property.util :as pu]
             [frontend.ui :as ui]
             [frontend.context.i18n :refer [t]]
@@ -414,10 +415,19 @@
           (reset! *src asset-path)))
       (when @*src
         [:span.hl-area
-         [:span.actions
+         [:span.actions.py-2.px-1
+          (when-let [asset-uuid (and (config/db-based-graph?)
+                             (some-> block (:logseq.property.pdf/hl-image) (:block/uuid)))]
+            [:button.asset-action-btn.px-1
+             {:title (t :asset/ref-block)
+              :tabIndex "-1"
+              :on-pointer-down util/stop
+              :on-click (fn [] (route-handler/redirect-to-page! asset-uuid))}
+             (ui/icon "file-symlink")])
+
           (when-not config/publishing?
             [:button.asset-action-btn.px-1
-             {:title         (t :asset/copy)
+             {:title (t :asset/copy)
               :tabIndex      "-1"
               :on-pointer-down util/stop
               :on-click      (fn [e]

+ 1 - 0
src/resources/dicts/en.edn

@@ -190,6 +190,7 @@
  :asset/delete "Delete image"
  :asset/copy "Copy image"
  :asset/maximize "Maximize image"
+ :asset/ref-block "Asset ref block"
  :asset/confirm-delete "Are you sure you want to delete this {1}?"
  :asset/physical-delete "Remove the file too (notice it can't be restored)"
  :color/gray "Gray"