Browse Source

fix: only insert a new block when the previous insert op is finished

Tienson Qin 5 years ago
parent
commit
dbe9e20165
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/main/frontend/handler/editor.cljs

+ 4 - 2
src/main/frontend/handler/editor.cljs

@@ -752,8 +752,10 @@
 
 (defn insert-new-block!
   [state]
-  (state/set-editor-op! :insert)
-  (when-not config/publishing?
+  (when (and (not config/publishing?)
+             ;; wait for the previous insert op finished
+             (not= :insert (state/get-editor-op)))
+    (state/set-editor-op! :insert)
     (let [{:keys [block value format id config]} (get-state state)
           block-id (:block/uuid block)
           block (or (db/pull [:block/uuid block-id])