فهرست منبع

fix: file content cleared when onblur

Tienson Qin 3 سال پیش
والد
کامیت
10704da424
1فایلهای تغییر یافته به همراه8 افزوده شده و 7 حذف شده
  1. 8 7
      src/main/frontend/extensions/code.cljs

+ 8 - 7
src/main/frontend/extensions/code.cljs

@@ -260,13 +260,14 @@
                 state)
                 state)
    :did-update (fn [state]
    :did-update (fn [state]
                  (reset! (:code-options state) (last (:rum/args state)))
                  (reset! (:code-options state) (last (:rum/args state)))
-                 (->> state
-                      :rum/args
-                      last
-                      :lines
-                      butlast
-                      (string/join "")
-                      (.setValue @(:editor-atom state)))
+                 (when-not (:file? (first (:rum/args state)))
+                   (->> state
+                        :rum/args
+                        last
+                        :lines
+                        butlast
+                        (string/join "")
+                        (.setValue @(:editor-atom state))))
                  state)}
                  state)}
   [state _config id attr code _theme _options]
   [state _config id attr code _theme _options]
   [:div.extensions__code
   [:div.extensions__code