mirror of
https://github.com/logseq/logseq.git
synced 2026-04-24 22:25:01 +00:00
fix: disable auto-save when the editor is in composition
This commit is contained in:
@@ -1437,7 +1437,9 @@
|
||||
(save-current-block-when-idle! {}))
|
||||
([{:keys [check-idle? chan chan-callback]
|
||||
:or {check-idle? true}}]
|
||||
(when (nil? (state/get-editor-op))
|
||||
(when (and (nil? (state/get-editor-op))
|
||||
;; non English input method
|
||||
(not (state/editor-in-composition?)))
|
||||
(when-let [repo (state/get-current-repo)]
|
||||
(when (and (if check-idle? (state/input-idle? repo) true)
|
||||
(not (state/get-editor-show-page-search?))
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
:editor/show-input nil
|
||||
:editor/last-saved-cursor nil
|
||||
:editor/editing? nil
|
||||
:editor/in-composition? false
|
||||
:editor/pos 0
|
||||
:editor/content {}
|
||||
:editor/block nil
|
||||
@@ -981,6 +982,14 @@
|
||||
[value]
|
||||
(set-state! :graph/syncing? value))
|
||||
|
||||
(defn set-editor-in-composition!
|
||||
[value]
|
||||
(set-state! :editor/in-composition? value))
|
||||
|
||||
(defn editor-in-composition?
|
||||
[]
|
||||
(:editor/in-composition? @state))
|
||||
|
||||
(defn set-loading-files!
|
||||
[value]
|
||||
(set-state! :repo/loading-files? value))
|
||||
|
||||
@@ -28,16 +28,16 @@
|
||||
(state/sub :editor/show-page-search?)
|
||||
(state/sub :editor/show-block-search?)
|
||||
(state/sub :editor/show-template-search?))
|
||||
composition? (atom false)
|
||||
set-composition? #(reset! composition? %)
|
||||
on-composition (fn [e]
|
||||
(if skip-composition?
|
||||
(on-change e)
|
||||
(case e.type
|
||||
"compositionend" (do (set-composition? false) (on-change e))
|
||||
(set-composition? true))))
|
||||
"compositionend" (do
|
||||
(state/set-editor-in-composition! false)
|
||||
(on-change e))
|
||||
(state/set-editor-in-composition! true))))
|
||||
props (assoc props
|
||||
:on-change (fn [e] (when-not @composition?
|
||||
:on-change (fn [e] (when-not (state/editor-in-composition?)
|
||||
(on-change e)))
|
||||
:on-composition-start on-composition
|
||||
:on-composition-update on-composition
|
||||
|
||||
Reference in New Issue
Block a user