                                          ))))
 
 
+                      ; if we select a different app
                       :else
-                      (div {:onClick     #(go  (write-ui app [:submode] "editappname")
-                                               (write-ui app [:app-id] (<-- :id)))
-
-                            :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em" ::marginTop "0.7em"}}
-                           (str (<-- :application_name))))
+                      (do
+                        (div {:onClick     #(go  (write-ui app [:submode] "editappname")
+                                                 (write-ui app [:app-id] (<-- :id)))
+
+                              :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em" ::marginTop "0.7em"}}
+                             (str (<-- :application_name)))))
 
 
 

                                             (write-ui app [:app-id] (<-- :id))
                                             (remote !loadapp {:id (<-- :id)})
                                             )
                             } "Edit")

                    ))))











(defn reeval [app-id]
  (go
    (let [code (js/getCodeMirrorValue)]
      (remote !savecode {:id app-id :code code})
      (js/sendcode (str code))
      )))







(defn-ui-component     editor-component   [app]
  {:on-mount
   (do  (go (if  (read-ui app [:app-id])
              (let [x (remote  !getfilecontents  {:id (read-ui app [:app-id]) })]

                (js/createEditor)
                (js/populateEditor (get x :value))
                (reeval (read-ui app [:app-id]))
                ;(js/populateEditor (str "Loaded: " (read-ui app [:app-id])))
                ;(js/alert (str "loaded" (read-ui app [:app-id])))
                ))))}


  (div nil
       (div nil (str (read-ui app [:app-id])))
       (textarea {:id "cm" :style {:display "inline-block" :width "1200" :height "800"}} "")))



