fix: editing empty last block if :replace-empty-target? non-nils

Also, disable `edit-block?` for some functions
This commit is contained in:
llcc
2022-04-28 11:56:04 +08:00
committed by Tienson Qin
parent 810bc2d710
commit 09e3fb1321
4 changed files with 12 additions and 9 deletions

View File

@@ -650,7 +650,10 @@
:keep-uuid? true
:replace-empty-target? replace-empty-target?})
(when edit-block?
(js/setTimeout #(edit-block! new-block :max (:block/uuid new-block)) 10))
(if (and replace-empty-target?
(string/blank? (:block/content last-block)))
(js/setTimeout #(edit-block! last-block :max (:block/uuid last-block)) 10)
(js/setTimeout #(edit-block! new-block :max (:block/uuid new-block)) 10)))
new-block))))))
(defn insert-first-page-block-if-not-exists!