mirror of
https://github.com/logseq/logseq.git
synced 2026-05-26 21:54:26 +00:00
fix: whiteboard files not saved
This commit is contained in:
@@ -248,6 +248,7 @@
|
||||
|
||||
(transact
|
||||
[_this repo tx-data tx-meta context]
|
||||
(when repo (state/set-db-latest-tx-time! repo))
|
||||
(when-let [conn (state/get-datascript-conn repo)]
|
||||
(try
|
||||
(let [tx-data (edn/read-string tx-data)
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
[repo conn page-db-id outliner-op context]
|
||||
(let [page-block (d/pull @conn '[*] page-db-id)
|
||||
page-db-id (:db/id page-block)
|
||||
whiteboard? (contains? (:block/type page-block) "whiteboard")
|
||||
whiteboard? (contains? (set (:block/type page-block)) "whiteboard")
|
||||
blocks-count (ldb/get-page-blocks-count @conn page-db-id)
|
||||
blocks-just-deleted? (and (zero? blocks-count)
|
||||
(contains? #{:delete-blocks :move-blocks} outliner-op))]
|
||||
@@ -69,7 +69,8 @@
|
||||
blocks (if whiteboard? (map cleanup-whiteboard-block blocks) blocks)]
|
||||
(when-not (and (= 1 (count blocks))
|
||||
(string/blank? (:block/content (first blocks)))
|
||||
(nil? (:block/file page-block)))
|
||||
(nil? (:block/file page-block))
|
||||
(not whiteboard?))
|
||||
(let [tree-or-blocks (if whiteboard? blocks
|
||||
(otree/blocks->vec-tree repo @conn blocks (:block/name page-block)))]
|
||||
(if page-block
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
file-db-id (-> page-block :block/file :db/id)
|
||||
file-path (-> (d/entity db file-db-id) :file/path)]
|
||||
(if (and (string? file-path) (not-empty file-path))
|
||||
(let [new-content (if (contains? (:block/type page-block) "whiteboard")
|
||||
(let [new-content (if (contains? (set (:block/type page-block)) "whiteboard")
|
||||
(->
|
||||
(wfu/ugly-pr-str {:blocks tree
|
||||
:pages (list (remove-transit-ids page-block))})
|
||||
|
||||
@@ -31,13 +31,17 @@
|
||||
[repo & {:keys [diff]
|
||||
:or {diff 1000}}]
|
||||
(when repo
|
||||
(let [last-input-time (get @(get @*state :db/latest-transact-time) repo)]
|
||||
(let [last-input-time (get-in @*state [:db/latest-transact-time repo])]
|
||||
(or
|
||||
(nil? last-input-time)
|
||||
|
||||
(let [now (worker-util/time-ms)]
|
||||
(>= (- now last-input-time) diff))))))
|
||||
|
||||
(defn set-db-latest-tx-time!
|
||||
[repo]
|
||||
(swap! *state assoc-in [:db/latest-transact-time repo] (worker-util/time-ms)))
|
||||
|
||||
(defn get-context
|
||||
[]
|
||||
(:worker/context @*state))
|
||||
|
||||
Reference in New Issue
Block a user