mirror of https://github.com/logseq/logseq
parent
13dea5ebdd
commit
a97b4fedea
|
@ -612,28 +612,29 @@
|
||||||
|
|
||||||
(defn create-today-journal!
|
(defn create-today-journal!
|
||||||
[]
|
[]
|
||||||
(state/set-today! (date/today))
|
|
||||||
(when-let [repo (state/get-current-repo)]
|
(when-let [repo (state/get-current-repo)]
|
||||||
(when (or (db/cloned? repo)
|
(when (state/enable-journals? repo)
|
||||||
(and (or (config/local-db? repo)
|
(state/set-today! (date/today))
|
||||||
(= "local" repo))
|
(when (or (db/cloned? repo)
|
||||||
;; config file exists
|
(and (or (config/local-db? repo)
|
||||||
(let [path (config/get-config-path)]
|
(= "local" repo))
|
||||||
(db/get-file path))))
|
;; config file exists
|
||||||
(let [title (date/today)
|
(let [path (config/get-config-path)]
|
||||||
today-page (string/lower-case title)
|
(db/get-file path))))
|
||||||
template (state/get-default-journal-template)]
|
(let [title (date/today)
|
||||||
(when (db/page-empty? repo today-page)
|
today-page (string/lower-case title)
|
||||||
(create! title {:redirect? false
|
template (state/get-default-journal-template)]
|
||||||
:split-namespace? false
|
(when (db/page-empty? repo today-page)
|
||||||
:create-first-block? (not template)
|
(create! title {:redirect? false
|
||||||
:journal? true})
|
:split-namespace? false
|
||||||
(when template
|
:create-first-block? (not template)
|
||||||
(let [page (db/pull [:block/name today-page])]
|
:journal? true})
|
||||||
(editor-handler/insert-template!
|
(when template
|
||||||
nil
|
(let [page (db/pull [:block/name today-page])]
|
||||||
template
|
(editor-handler/insert-template!
|
||||||
{:get-pos-fn (fn []
|
nil
|
||||||
[page false false false])
|
template
|
||||||
:page-block page})
|
{:get-pos-fn (fn []
|
||||||
(ui-handler/re-render-root!))))))))
|
[page false false false])
|
||||||
|
:page-block page})
|
||||||
|
(ui-handler/re-render-root!)))))))))
|
||||||
|
|
Loading…
Reference in New Issue