mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 09:56:31 +00:00
fix: auto save on editing properties
This commit is contained in:
@@ -1270,7 +1270,7 @@
|
||||
(defn save-current-block!
|
||||
([]
|
||||
(save-current-block! {}))
|
||||
([{:keys [force?] :as opts}]
|
||||
([{:keys [force? skip-properties?] :as opts}]
|
||||
;; non English input method
|
||||
(when-not (state/editor-in-composition?)
|
||||
(when (state/get-current-repo)
|
||||
@@ -1296,6 +1296,11 @@
|
||||
force?
|
||||
(save-block-aux! db-block value opts)
|
||||
|
||||
(and skip-properties?
|
||||
(db-model/top-block? block)
|
||||
(when elem (thingatpt/properties-at-point elem)))
|
||||
nil
|
||||
|
||||
(and block value db-content-without-heading
|
||||
(not= (string/trim db-content-without-heading)
|
||||
(string/trim value)))
|
||||
@@ -1801,17 +1806,14 @@
|
||||
(when @*auto-save-timeout
|
||||
(js/clearTimeout @*auto-save-timeout))
|
||||
(mark-last-input-time! repo)
|
||||
(when-not
|
||||
(and
|
||||
(= (:db/id (:block/parent block))
|
||||
(:db/id (:block/page block))) ; don't auto-save for page's properties block
|
||||
(get-in block [:block/properties :title]))
|
||||
(when-not (and (db-model/top-block? block) ; don't auto-save for page's properties block
|
||||
(not-empty (:block/properties block)))
|
||||
(reset! *auto-save-timeout
|
||||
(js/setTimeout
|
||||
(fn []
|
||||
(when (state/input-idle? repo)
|
||||
(state/set-editor-op! :auto-save)
|
||||
(save-current-block! {})
|
||||
(save-current-block! {:skip-properties? true})
|
||||
(state/set-editor-op! nil)))
|
||||
500)))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user