Skip to content

Commit

Permalink
fix: query with breadcrumbs show blocks on wrong hierarchy
Browse files Browse the repository at this point in the history
close #5859
  • Loading branch information
tiensonqin committed Mar 29, 2023
1 parent ecdb68b commit 43bb773
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/main/frontend/components/block.cljs
Expand Up @@ -3699,10 +3699,17 @@
[:div
(page-cp config page)
(when alias? [:span.text-sm.font-medium.opacity-50 " Alias"])]
(for [[parent blocks] parent-blocks]
(rum/with-key
(breadcrumb-with-container blocks config)
(:db/id parent)))
(let [{top-level-blocks true others false} (group-by
(fn [b] (= (:db/id page) (:db/id (first b))))
parent-blocks)
sorted-parent-blocks (concat top-level-blocks others)]
(for [[parent blocks] sorted-parent-blocks]
[:div {:class (if (= (:db/id parent) (:db/id page))
"top-level-matched-blocks"
"nested-matched-blocks")}
(rum/with-key
(breadcrumb-with-container blocks config)
(:db/id parent))]))
{:debug-id page
:trigger-once? false})])))))]

Expand Down
6 changes: 5 additions & 1 deletion src/main/frontend/components/block.css
Expand Up @@ -632,6 +632,10 @@ a.cloze-revealed {
opacity: 1;
}

.nested-matched-blocks {
margin-left: 27px;
}

.cp__fenced-code-block {
.not-edit {
cursor: default;
Expand Down Expand Up @@ -659,4 +663,4 @@ html.is-mac {
cursor: pointer;
}
}
}
}

0 comments on commit 43bb773

Please sign in to comment.