fix: Active breadcrumbs in node property dropdown menu

fixes https://github.com/logseq/db-test/issues/565
This commit is contained in:
Tienson Qin
2025-11-09 09:02:46 +08:00
parent e99f2b6b8d
commit 2122d3d27c
3 changed files with 13 additions and 6 deletions

View File

@@ -3296,7 +3296,7 @@
;; "block-id - uuid of the target block of breadcrumb. page uuid is also acceptable"
(rum/defc breadcrumb-aux < rum/reactive
[config repo block-id {:keys [show-page? indent? end-separator? _navigating-block]
[config repo block-id {:keys [show-page? indent? end-separator? _navigating-block disabled?]
:or {show-page? true}
:as opts}]
(let [from-property (when (and block-id (config/db-based-graph? repo))
@@ -3312,7 +3312,10 @@
(let [parents-props (doall
(for [{:block/keys [uuid name title] :as block} parents]
(if name
[block (page-cp {:disable-preview? true} block) true]
[block (page-cp (cond-> {:disable-preview? true}
disabled?
(assoc :disable-click? true))
block) true]
(let [result (block/parse-title-and-body
uuid
(get block :block/format :markdown)
@@ -3333,7 +3336,9 @@
label' (if page?
label
(breadcrumb-fragment config block label opts))]
(rum/with-key label' (str (:block/uuid block))))))
(if (:disabled? opts)
label
(rum/with-key label' (str (:block/uuid block)))))))
(interpose (breadcrumb-separator)))]
(when (seq breadcrumbs)
[:div.breadcrumb.block-parents
@@ -3349,7 +3354,7 @@
(when end-separator? (breadcrumb-separator))])))))
(rum/defc breadcrumb
[config repo block-id {:keys [_show-page? _indent? _end-separator? _navigating-block]
[config repo block-id {:keys [_show-page? _indent? _end-separator? _navigating-block _disabled?]
:as opts}]
(let [[block set-block!] (hooks/use-state (when (uuid? block-id)
(db/entity [:block/uuid block-id])))]

View File

@@ -213,7 +213,8 @@
(when (and (:block/uuid block') (or (:block/parent block') (not (:page? block))))
(when-let [breadcrumb (state/get-component :block/breadcrumb)]
[:div.text-xs.opacity-70.mb-1 {:style {:margin-left 3}}
(breadcrumb {:search? true} (state/get-current-repo) (:block/uuid block') {})]))
(breadcrumb {:search? true} (state/get-current-repo) (:block/uuid block')
{:disabled? true})]))
[:div.flex.flex-row.items-start
(when-not (or db-tag? (not db-based?))
[:div.flex.items-center.h-5.mr-1.opacity-50

View File

@@ -764,7 +764,8 @@
header (when-not (db/page? node)
(when-let [breadcrumb (state/get-component :block/breadcrumb)]
[:div.text-xs.opacity-70
(breadcrumb {:search? true} (state/get-current-repo) (:block/uuid node) {})]))
(breadcrumb {:search? true} (state/get-current-repo) (:block/uuid node)
{:disabled? true})]))
label [:div.flex.flex-row.items-center.gap-1
(when-not (or (:logseq.property/classes property)
(contains? #{:class :property} (:logseq.property/type property)))