mirror of
https://github.com/logseq/logseq.git
synced 2026-04-29 08:26:40 +00:00
fix(editor): wrong file editing save condition
This commit is contained in:
@@ -44,10 +44,13 @@
|
||||
rpath (path/trim-dir-prefix repo-dir path)]
|
||||
(if rpath
|
||||
;; in-db file
|
||||
(let [old-content (or (db/get-file rpath) "")]
|
||||
(when (and
|
||||
(not (string/blank? value))
|
||||
(not= (string/trim value) (string/trim old-content)))
|
||||
(let [db-content (db/get-file rpath)
|
||||
not-in-db? (nil? db-content)
|
||||
old-content (or db-content "")
|
||||
contents-matched? (= (string/trim value) (string/trim old-content))]
|
||||
(when (or
|
||||
(and not-in-db? (not-empty value))
|
||||
(not contents-matched?))
|
||||
(file-handler/alter-file (state/get-current-repo)
|
||||
rpath
|
||||
(str (string/trim value) "\n")
|
||||
|
||||
Reference in New Issue
Block a user