fix: can't collapse/expand in the references

Addresses #3642
This commit is contained in:
Tienson Qin
2021-12-30 00:09:19 +08:00
parent 10ace94b09
commit 6b080b6691

View File

@@ -1422,7 +1422,7 @@
(every? #(= % ["Horizontal_Rule"]) body)))
(rum/defcs block-control < rum/reactive
[state config block uuid block-id body children collapsed? *control-show? edit?]
[state config block uuid block-id body children collapsed? *default-collapsed? *control-show? edit?]
(let [doc-mode? (state/sub :document/mode?)
has-children-blocks? (and (coll? children) (seq children))
has-child? (and
@@ -1446,6 +1446,7 @@
:on-click (fn [event]
(util/stop event)
(when-not (and (not collapsed?) (not has-child?))
(when ref? (swap! *default-collapsed? not))
(if collapsed?
(editor-handler/expand-block! uuid)
(editor-handler/collapse-block! uuid))))}
@@ -2264,7 +2265,7 @@
:on-mouse-leave (fn [e]
(block-mouse-leave e *control-show? block-id doc-mode?))}
(when (not slide?)
(block-control config block uuid block-id body children collapsed? *control-show? edit?))
(block-control config block uuid block-id body children collapsed? *default-collapsed? *control-show? edit?))
(block-content-or-editor config block edit-input-id block-id heading-level edit?)]