enhance: block expand/collapse toggle

1. Display `Expand all` where there're already collapsed blocks. This applies to `Collapse all` too.
2. Make the guideline bold when hovering on it.
3. Simplify some logic
This commit is contained in:
Tienson Qin
2021-12-26 13:13:21 +08:00
committed by Andelf
parent f54326f24e
commit 1cff06f347
5 changed files with 104 additions and 88 deletions

View File

@@ -1351,9 +1351,10 @@
(defn- toggle-block-children
[e children]
(let [block-ids (map :block/uuid children)]
(if (some editor-handler/collapsable? block-ids)
(dorun (map editor-handler/collapse-block! block-ids))
(dorun (map editor-handler/expand-block! block-ids)))))
(dorun
(if (some editor-handler/collapsable? block-ids)
(map editor-handler/collapse-block! block-ids)
(map editor-handler/expand-block! block-ids)))))
(rum/defc block-children < rum/reactive
[config children collapsed? *ref-collapsed?]