Просмотр исходного кода

fix: file content cleared when onblur

Tienson Qin 3 лет назад
Родитель
Сommit
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)
    :did-update (fn [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 _config id attr code _theme _options]
   [:div.extensions__code