enhance: set edit content if the last content datom is added

This commit is contained in:
Tienson Qin
2023-09-17 17:13:30 +08:00
parent 50c7b371d2
commit 80d5967add

View File

@@ -25,13 +25,12 @@
(defn- reset-editing-block-content!
[tx-data]
(when-let [edit-block (state/get-edit-block)]
(when-let [new-content (-> (filter (fn [datom]
(and (= :block/content (:a datom))
(:added datom)
(= (:e datom) (:db/id edit-block)))) tx-data)
last
:v)]
(state/set-edit-content! (state/get-input) new-content))))
(when-let [last-datom (-> (filter (fn [datom]
(and (= :block/content (:a datom))
(= (:e datom) (:db/id edit-block)))) tx-data)
last)]
(when (:added last-datom)
(state/set-edit-content! (state/get-input) (:v last-datom))))))
(defn invoke-hooks
[tx-report]