Forráskód Böngészése

incorporate PR review feedback

Devon Zuegel 4 éve
szülő
commit
e3c87fa232
1 módosított fájl, 13 hozzáadás és 2 törlés
  1. 13 2
      src/main/frontend/components/page_menu.cljs

+ 13 - 2
src/main/frontend/components/page_menu.cljs

@@ -91,6 +91,16 @@
                                   :page-presentation
                                   :page-presentation
                                   {:page page}))}}
                                   {:page page}))}}
 
 
+          ;; TODO: In the future, we'd like to extract file-related actions
+          ;; (such as open-in-finder & open-with-default-app) into a sub-menu of
+          ;; this one. However this component doesn't yet exist. PRs are welcome!
+          ;; Details: https://github.com/logseq/logseq/pull/3003#issuecomment-952820676
+          (when-let [file-path (and (util/electron?) (page-handler/get-page-file-path))]
+            [{:title   (t :page/open-in-finder)
+              :options {:on-click #(js/window.apis.showItemInFolder file-path)}}
+             {:title   (t :page/open-with-default-app)
+              :options {:on-click #(js/window.apis.openPath file-path)}}])
+
           (when-not contents?
           (when-not contents?
             {:title   (t :page/delete)
             {:title   (t :page/delete)
              :options {:on-click #(state/set-modal! (delete-page-dialog page-name))}})
              :options {:on-click #(state/set-modal! (delete-page-dialog page-name))}})
@@ -131,8 +141,9 @@
                                       [:div
                                       [:div
                                        [:pre.code page-data]
                                        [:pre.code page-data]
                                        [:br]
                                        [:br]
-                                       (ui/button "Copy to clipboard"
-                                         :on-click #(.writeText js/navigator.clipboard page-data))]
+                                       (ui/button
+                                        "Copy to clipboard"
+                                        :on-click #(.writeText js/navigator.clipboard page-data))]
                                       :success
                                       :success
                                       false)))}})]
                                       false)))}})]
          (flatten)
          (flatten)