enhance: open the last block when inserting template blocks

This commit is contained in:
Tienson Qin
2021-09-22 14:18:37 +08:00
parent 6266f33f21
commit 16068df62f

View File

@@ -2202,11 +2202,8 @@
last-block (paste-block-vec-tree-at-target tree [:id :template :template-including-parent] opts)]
(clear-when-saved!)
(db/refresh! repo {:key :block/insert :data [(db/pull db-id)]})
;; FIXME:
;; (js/setTimeout
;; #(edit-block! {:block/uuid (:block/uuid last-block)} :max nil (:block/uuid last-block))
;; 100)
)))
(let [block (:data (last (flatten last-block)))]
(edit-block! block :max (:block/format block) (:block/uuid block))))))
(when-let [input (gdom/getElement element-id)]
(.focus input))))