Merge branch 'master' into enhance/i18n

This commit is contained in:
megayu
2026-04-16 16:05:13 +08:00
committed by GitHub
4 changed files with 25 additions and 11 deletions

View File

@@ -36,6 +36,22 @@
(rest parts)))
(string/join " #"))))
(defn- find-page-add-button
[page-id]
(when page-id
(->> (dom/sel ".block-add-button")
(filter #(= (str page-id) (dom/attr % "parentblockid")))
first)))
(defn- click-page-add-button-with-retry!
[page-id]
(letfn [(poll! [remaining-ms]
(if-let [block-add-button (find-page-add-button page-id)]
(.click block-add-button)
(when (pos? remaining-ms)
(js/setTimeout #(poll! (- remaining-ms 100)) 100))))]
(poll! 500)))
(defn <create!
([title]
(<create! title {}))
@@ -82,13 +98,7 @@
(when redirect?
(route-handler/redirect-to-page! page-uuid)
(when-not today-journal?
(js/setTimeout
(fn []
(when-let [block-add-button (->> (dom/sel ".block-add-button")
(filter #(= (str (:db/id page)) (dom/attr % "parentblockid")))
first)]
(.click block-add-button)))
200)))
(click-page-add-button-with-retry! (:db/id page))))
page)))))))))
;; favorite fns

View File

@@ -125,7 +125,7 @@
(defn- ws-open? [ws]
(sync-transport/ws-open? ws))
(defn- upload-large-title! [repo graph-id title aes-key]
(defn upload-large-title! [repo graph-id title aes-key]
(sync-large-title/upload-large-title!
{:repo repo
:graph-id graph-id

View File

@@ -125,7 +125,7 @@
:process-batch-f
(fn [batch]
(p/let [datoms* (sync-large-title/offload-large-titles-in-datoms-batch
repo graph-id batch aes-key sync-large-title/upload-large-title!)
repo graph-id batch aes-key sync-apply/upload-large-title!)
encrypted-datoms (if aes-key
(sync-crypt/<encrypt-datoms aes-key datoms*)
datoms*)