Procházet zdrojové kódy

fix: error when editing config.edn

rcmerci před 4 roky
rodič
revize
5c6c7a7939
1 změnil soubory, kde provedl 5 přidání a 5 odebrání
  1. 5 5
      src/main/frontend/extensions/code.cljs

+ 5 - 5
src/main/frontend/extensions/code.cljs

@@ -155,11 +155,11 @@
                                  (save-file-or-block-when-blur-or-esc! editor textarea config state))))
           (.addEventListener element "mousedown"
                              (fn [e]
-                               (let [block (into {} (db/get-block-by-uuid (:block/uuid config)))]
-                                 (state/clear-selection!)
-                                 (state/set-editing! id (.getValue editor) block nil false)
-                                 (util/stop e)
-                                 (state/set-block-component-editing-mode! true))))
+                               (state/clear-selection!)
+                               (when-let [block (and (:block/uuid config) (into {} (db/get-block-by-uuid (:block/uuid config))))]
+                                 (state/set-editing! id (.getValue editor) block nil false))
+                               (util/stop e)
+                               (state/set-block-component-editing-mode! true)))
           (.save editor)
           (.refresh editor)))
       editor)))