From 80d5967add7d8c7f35fa60e552b3af9f0b4f12ba Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Sun, 17 Sep 2023 17:13:30 +0800 Subject: [PATCH] enhance: set edit content if the last content datom is added --- src/main/frontend/modules/outliner/pipeline.cljs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/frontend/modules/outliner/pipeline.cljs b/src/main/frontend/modules/outliner/pipeline.cljs index b50835f969..3a53fbffee 100644 --- a/src/main/frontend/modules/outliner/pipeline.cljs +++ b/src/main/frontend/modules/outliner/pipeline.cljs @@ -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]