mirror of
https://github.com/logseq/logseq.git
synced 2026-05-29 23:19:38 +00:00
Clean setTimeout
This commit is contained in:
@@ -36,14 +36,13 @@
|
||||
(let [repo (state/get-current-repo)
|
||||
conn (db/get-db repo false)
|
||||
config (state/get-config repo)]
|
||||
(when-let [page-name (worker-page/create! repo conn config title options)]
|
||||
(when redirect?
|
||||
(route-handler/redirect-to-page! page-name))
|
||||
(js/setTimeout
|
||||
#(when-let [first-block (first (:block/_left (db/entity [:block/name page-name])))]
|
||||
(block-handler/edit-block! first-block :max nil))
|
||||
100)
|
||||
page-name))))
|
||||
(p/let [_ (worker-page/create! repo conn config title options)]
|
||||
(let [[_ page-name] (worker-page/get-title-and-pagename title)]
|
||||
(when redirect?
|
||||
(route-handler/redirect-to-page! page-name))
|
||||
(when-let [first-block (first (:block/_left (db/entity [:block/name page-name])))]
|
||||
(block-handler/edit-block! first-block :max nil))
|
||||
page-name)))))
|
||||
|
||||
;; favorite fns
|
||||
;; ============
|
||||
|
||||
@@ -21,9 +21,7 @@
|
||||
(when content
|
||||
(editor-handler/restore-cursor-pos! id content)))
|
||||
|
||||
;; Here we delay this listener, otherwise the click to edit event will trigger a outside click event,
|
||||
;; which will hide the editor so no way for editing.
|
||||
(js/setTimeout #(keyboards-handler/esc-save! state) 100)
|
||||
(keyboards-handler/esc-save! state)
|
||||
|
||||
(when-let [element (gdom/getElement id)]
|
||||
(.focus element)
|
||||
|
||||
@@ -284,15 +284,15 @@
|
||||
format (state/get-preferred-format repo)
|
||||
template (state/get-default-journal-template)
|
||||
create-f (fn []
|
||||
(create! title {:redirect? false
|
||||
:split-namespace? false
|
||||
:create-first-block? (not template)
|
||||
:journal? true
|
||||
:today-journal? true})
|
||||
(js/setTimeout #(do
|
||||
(state/pub-event! [:journal/insert-template today-page])
|
||||
(ui-handler/re-render-root!)
|
||||
(plugin-handler/hook-plugin-app :today-journal-created {:title today-page})) 100))]
|
||||
(p/do!
|
||||
(create! title {:redirect? false
|
||||
:split-namespace? false
|
||||
:create-first-block? (not template)
|
||||
:journal? true
|
||||
:today-journal? true})
|
||||
(state/pub-event! [:journal/insert-template today-page])
|
||||
(ui-handler/re-render-root!)
|
||||
(plugin-handler/hook-plugin-app :today-journal-created {:title today-page})))]
|
||||
(when (db/page-empty? repo today-page)
|
||||
(if (config/db-based-graph? repo)
|
||||
(let [page-exists (db/get-page today-page)]
|
||||
|
||||
Reference in New Issue
Block a user