Преглед изворни кода

fix: don't save twice when esc

Tienson Qin пре 1 година
родитељ
комит
ed0429b088

+ 1 - 0
src/main/frontend/components/block.cljs

@@ -2540,6 +2540,7 @@
                                                  (let [select? (and (= event :esc)
                                                                     (not (string/includes? value "```")))]
                                                    (p/do!
+                                                    (state/set-editor-op! :escape)
                                                     (editor-handler/save-block! (editor-handler/get-state) value)
                                                     (editor-handler/escape-editing select?))))}
                                      edit-input-id

+ 1 - 1
src/main/frontend/handler/editor/lifecycle.cljs

@@ -41,7 +41,7 @@
     (editor-handler/clear-when-saved!)
     (state/set-editor-op! nil)
     (when (db/entity [:block/uuid (:block/uuid block)]) ; block still exists
-      (when-not (or (contains? #{:undo :redo} editor-op)
+      (when-not (or (contains? #{:undo :redo :escape} editor-op)
                     (state/editor-in-composition?))
         (editor-handler/save-block! state value))))
   state)