fix: first block not saved for a new page

Related to #1400
pull/1407/head
Tienson Qin 2021-03-02 18:00:10 +08:00
parent 6747f54575
commit dcb49ce7d0
1 changed files with 5 additions and 8 deletions

View File

@ -802,15 +802,12 @@
;; create the file
(let [content (util/default-content-with-title format (or
(:page/original-name page)
(:page/name page)))]
(p/let [_ (fs/create-if-not-exists repo dir file-path content)
(:page/name page)))
value (block-text-with-time nil format value)
new-content (str content value "\n" snd-block-text)]
(p/let [_ (fs/create-if-not-exists repo dir file-path new-content)
_ (git-handler/git-add repo path)]
(let [value (block-text-with-time nil format value)]
(file-handler/reset-file! repo path
(str content
value
"\n"
snd-block-text)))
(file-handler/reset-file! repo path new-content)
(ui-handler/re-render-root!)
;; Continue to edit the last block