diff --git a/src/main/frontend/components/block.cljs b/src/main/frontend/components/block.cljs index 71cc8fd87..2c55653f8 100644 --- a/src/main/frontend/components/block.cljs +++ b/src/main/frontend/components/block.cljs @@ -3028,7 +3028,9 @@ (block-mouse-leave e *control-show? block-id doc-mode?))} (when (and (not slide?) (not in-whiteboard?) (not hidden?)) (block-control config block uuid block-id collapsed? *control-show? - (or edit? (= uuid (:block/uuid (state/get-edit-block)))))) + (or edit? + (= uuid (:block/uuid (state/get-edit-block))) + (contains? @(:editor/new-created-blocks @state/state) uuid)))) (when (and @*show-left-menu? (not in-whiteboard?) (not hidden?)) (block-left-menu config block)) diff --git a/src/main/frontend/modules/outliner/pipeline.cljs b/src/main/frontend/modules/outliner/pipeline.cljs index 6a80fa1ee..1a1f75311 100644 --- a/src/main/frontend/modules/outliner/pipeline.cljs +++ b/src/main/frontend/modules/outliner/pipeline.cljs @@ -55,6 +55,13 @@ (when-not (or undo? redo?) (update-current-tx-editor-cursor! tx-report))) + (let [new-datoms (filter (fn [datom] + (and + (= :block/uuid (:a datom)) + (true? (:added datom)))) tx-data)] + (when (seq new-datoms) + (state/set-state! :editor/new-created-blocks (set (map :v new-datoms))))) + (let [pages (set (keep #(when (= :block/name (:a %)) (:v %)) tx-data))] (when (seq pages) (mark-pages-as-loaded! repo pages))) diff --git a/src/main/frontend/state.cljs b/src/main/frontend/state.cljs index c03c0c88e..2fe3d03f4 100644 --- a/src/main/frontend/state.cljs +++ b/src/main/frontend/state.cljs @@ -150,6 +150,7 @@ :db/properties-changed-pages {} :editor/cursor-range (atom nil) + :editor/new-created-blocks (atom #{}) :selection/mode (atom false) ;; Warning: blocks order is determined when setting this attribute