fix: data-refs / data-refs-self regression

close #2764
pull/2793/head
Tienson Qin 2021-09-08 00:07:45 +08:00
parent ce511e1b84
commit 54700b3707
1 changed files with 13 additions and 1 deletions

View File

@ -2017,6 +2017,17 @@
(remove nil?)))]
(text/build-data-value refs)))
(defn- get-children-refs
[children]
(let [refs (atom [])]
(walk/postwalk
(fn [m]
(when (and (map? m) (:block/refs m))
(swap! refs concat (:block/refs m)))
m)
children)
(distinct @refs)))
;; (rum/defc block-immediate-children < rum/reactive
;; [repo config uuid ref? collapsed?]
;; (when (and ref? (not collapsed?))
@ -2075,7 +2086,8 @@
(or (and (coll? children) (seq children))
(seq body))))
attrs (on-drag-and-mouse-attrs block uuid top? block-id *move-to has-child? *control-show? doc-mode?)
data-refs (build-refs-data-value block (remove (set refs) path-refs))
children-refs (get-children-refs children)
data-refs (build-refs-data-value block children-refs)
data-refs-self (build-refs-data-value block refs)
edit-input-id (str "edit-block-" blocks-container-id "-" uuid)
edit? (state/sub [:editor/editing? edit-input-id])]