mirror of https://github.com/logseq/logseq
parent
b3d01a869b
commit
156b152129
|
@ -1450,11 +1450,13 @@
|
|||
(mapv (fn [page] [:db.fn/retractEntity [:block/name page]]) (map util/page-name-sanity-lc pages)))))
|
||||
|
||||
(defn set-file-content!
|
||||
[repo path content]
|
||||
(when (and repo path)
|
||||
(let [tx-data {:file/path path
|
||||
:file/content content}]
|
||||
(db-utils/transact! repo [tx-data] {:skip-refresh? true}))))
|
||||
([repo path content]
|
||||
(set-file-content! repo path content {}))
|
||||
([repo path content opts]
|
||||
(when (and repo path)
|
||||
(let [tx-data {:file/path path
|
||||
:file/content content}]
|
||||
(db-utils/transact! repo [tx-data] (merge opts {:skip-refresh? true}))))))
|
||||
|
||||
(defn get-pre-block
|
||||
[repo page-id]
|
||||
|
|
|
@ -155,16 +155,18 @@
|
|||
#(p/resolved nil)
|
||||
#(fs/write-file! repo (config/get-repo-dir repo) path content
|
||||
(assoc (when original-content {:old-content original-content})
|
||||
:skip-compare? skip-compare?)))]
|
||||
:skip-compare? skip-compare?)))
|
||||
opts {:new-graph? new-graph?
|
||||
:from-disk? from-disk?}]
|
||||
(if reset?
|
||||
(do
|
||||
(when-let [page-id (db/get-file-page-id path)]
|
||||
(db/transact! repo
|
||||
[[:db/retract page-id :block/alias]
|
||||
[:db/retract page-id :block/tags]]))
|
||||
(reset-file! repo path content {:new-graph? new-graph?
|
||||
:from-disk? from-disk?}))
|
||||
(db/set-file-content! repo path content))
|
||||
[:db/retract page-id :block/tags]]
|
||||
opts))
|
||||
(reset-file! repo path content opts))
|
||||
(db/set-file-content! repo path content opts))
|
||||
(util/p-handle (write-file!)
|
||||
(fn [_]
|
||||
(when (= path (config/get-config-path repo))
|
||||
|
|
|
@ -268,7 +268,8 @@
|
|||
(repo-handler/load-repo-to-db! repo
|
||||
{:diffs diffs
|
||||
:nfs-files modified-files
|
||||
:refresh? (not re-index?)}))
|
||||
:refresh? (not re-index?)
|
||||
:new-graph? re-index?}))
|
||||
(when (and (util/electron?) (not re-index?))
|
||||
(db/transact! repo new-files))))))))
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
(when (and (not (:from-disk? (:tx-meta tx-report)))
|
||||
(not (:new-graph? (:tx-meta tx-report))))
|
||||
(let [{:keys [pages blocks]} (ds-report/get-blocks-and-pages tx-report)]
|
||||
(doseq [p (seq pages)] (updated-page-hook tx-report p))
|
||||
(doseq [p (seq pages)]
|
||||
(updated-page-hook tx-report p))
|
||||
(when (and state/lsp-enabled? (seq blocks))
|
||||
(state/pub-event! [:plugin/hook-db-tx
|
||||
{:blocks blocks
|
||||
|
|
Loading…
Reference in New Issue