fix: collapsing multi-line block

close #6374
pull/6378/head
Tienson Qin 2022-08-16 11:21:59 +08:00
parent aa38e83fa4
commit 220a55b756
2 changed files with 14 additions and 10 deletions

View File

@ -2091,14 +2091,18 @@
(not (:slide? config)))
(properties-cp config block))
(when (and (not block-ref-with-title?) (seq body))
[:div.block-body {:style {:display (if (and collapsed? (seq title)) "none" "")}}
(let [title-collapse-enabled? (:outliner/block-title-collapse-enabled? (state/get-config))]
(when (and (not block-ref-with-title?)
(seq body)
(or (not title-collapse-enabled?)
(and title-collapse-enabled? (not collapsed?))))
[:div.block-body
;; TODO: consistent id instead of the idx (since it could be changed later)
(let [body (block/trim-break-lines! (:block/body block))]
(for [[idx child] (medley/indexed body)]
(when-let [block (markup-element-cp config child)]
(rum/with-key (block-child block)
(str uuid "-" idx)))))])
(str uuid "-" idx)))))]))
(case (:block/warning block)
:multiple-blocks