mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix: drag files to logseq can be stuck
This commit is contained in:
@@ -106,9 +106,9 @@
|
||||
(d/listen! conn :persistence
|
||||
(fn [tx-report]
|
||||
(when-not (util/electron?)
|
||||
(let [tx-id (get-tx-id tx-report)]
|
||||
(state/set-last-transact-time! repo (util/time-ms))
|
||||
(persist-if-idle! repo)))
|
||||
(let [tx-id (get-tx-id tx-report)]
|
||||
(state/set-last-transact-time! repo (util/time-ms))
|
||||
(persist-if-idle! repo)))
|
||||
|
||||
;; rebuild search indices
|
||||
(let [data (:tx-data tx-report)
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
(when-not (db/file-exists? repo path)
|
||||
(let [_ (file-handler/alter-file repo path content {:re-render-root? true
|
||||
:from-disk? true})]
|
||||
(db/set-file-last-modified-at! repo path mtime)))
|
||||
(db/set-file-last-modified-at! repo path mtime)
|
||||
;; return nil, otherwise the entire db will be transfered by ipc
|
||||
nil))
|
||||
|
||||
(and (= "change" type)
|
||||
(not (db/file-exists? repo path)))
|
||||
@@ -34,7 +36,8 @@
|
||||
(> mtime last-modified-at)))
|
||||
(let [_ (file-handler/alter-file repo path content {:re-render-root? true
|
||||
:from-disk? true})]
|
||||
(db/set-file-last-modified-at! repo path mtime))
|
||||
(db/set-file-last-modified-at! repo path mtime)
|
||||
nil)
|
||||
|
||||
(contains? #{"add" "change" "unlink"} type)
|
||||
nil
|
||||
|
||||
@@ -42,27 +42,29 @@
|
||||
|
||||
(defn- ->db-files
|
||||
[electron? dir-name result]
|
||||
(if electron?
|
||||
(map (fn [{:keys [path stat content]}]
|
||||
(let [{:keys [mtime size]} stat]
|
||||
{:file/path path
|
||||
:file/last-modified-at mtime
|
||||
:file/size size
|
||||
:file/content content}))
|
||||
result)
|
||||
(let [result (flatten (bean/->clj result))]
|
||||
(map (fn [file]
|
||||
(let [handle (gobj/get file "handle")
|
||||
get-attr #(gobj/get file %)
|
||||
path (-> (get-attr "webkitRelativePath")
|
||||
(string/replace-first (str dir-name "/") ""))]
|
||||
{:file/name (get-attr "name")
|
||||
:file/path path
|
||||
:file/last-modified-at (get-attr "lastModified")
|
||||
:file/size (get-attr "size")
|
||||
:file/type (get-attr "type")
|
||||
:file/file file
|
||||
:file/handle handle})) result))))
|
||||
(->>
|
||||
(if electron?
|
||||
(map (fn [{:keys [path stat content]}]
|
||||
(let [{:keys [mtime size]} stat]
|
||||
{:file/path path
|
||||
:file/last-modified-at mtime
|
||||
:file/size size
|
||||
:file/content content}))
|
||||
result)
|
||||
(let [result (flatten (bean/->clj result))]
|
||||
(map (fn [file]
|
||||
(let [handle (gobj/get file "handle")
|
||||
get-attr #(gobj/get file %)
|
||||
path (-> (get-attr "webkitRelativePath")
|
||||
(string/replace-first (str dir-name "/") ""))]
|
||||
{:file/name (get-attr "name")
|
||||
:file/path path
|
||||
:file/last-modified-at (get-attr "lastModified")
|
||||
:file/size (get-attr "size")
|
||||
:file/type (get-attr "type")
|
||||
:file/file file
|
||||
:file/handle handle})) result)))
|
||||
(sort-by :file/path)))
|
||||
|
||||
(defn- filter-markup-and-built-in-files
|
||||
[files]
|
||||
|
||||
Reference in New Issue
Block a user