       [:div.col-xs-12
        [:div.list-group
         [:a.list-group-item {:id "phrase1" :href "#" :on-click #(do
-                                                    (.preventDefault %)
-                                                    (process-text (t :badge/Endorsephrase1) state)
-                                                    )} [:i.fa.fa-plus-circle](t :badge/Endorsephrase1)]
+                                                                  (.preventDefault %)
+                                                                  (process-text (t :badge/Endorsephrase1) state)
+                                                                  )} [:i.fa.fa-plus-circle](t :badge/Endorsephrase1)]
         [:a.list-group-item {:href "#" :on-click #(do
                                                     (.preventDefault %)
                                                     (process-text (t :badge/Endorsephrase2) state)

                              "link" "horizontal-rule"
                              "preview"))

(defn init-editor [value element-id]
  (let [editor (js/SimpleMDE. (js-obj "element" (.getElementById js/document element-id)
                                      "toolbar" simplemde-toolbar
                                      "autofocus" "true"
                                      "spellChecker" "false"
                                      ))]

    (js/setTimeout (fn [] (.value editor @value)) 200) ;;delay for editor to load

    ;(.value editor @value)
    (set! (.-onclick js/document) (fn [] (js/setTimeout (fn [] (.value editor @value)) 10))) ;refresh editor value
    (.codemirror.on editor "mousedown" (fn [] (.value editor @value)))
    (.codemirror.on editor "change" (fn [] (reset! value (.value editor))))))

(defn markdown-editor [value]
  (create-class {:component-did-mount (fn []
                                        #_(.getScript (js* "$") "/js/simplemde.min.js")
                                        (init-editor value (str "editor" (-> (session/get :user) :id))))
                 :reagent-render (fn []
                                   [:div.form-group {:style {:display "block"}}
                                    [:textarea {:class "form-control"
                                                :id (str "editor" (-> (session/get :user) :id))
                                                :defaultValue @value
                                                ;:on-change #(reset! value (.-target.value %))
                                                }]]) }))

(defn process-text [s state]
  (let [text (-> js/document
                 (.getElementById (str "editor" (-> (session/get :user) :id)))
                 (.-innerHTML))
        endorsement-claim (str text (if (blank? text) "" "\n\n") "* " s)]
    (reset! (cursor state [:endorsement-comment]) endorsement-claim)))


(defn endorse-badge-content [state]

                                           :data-dismiss "modal"} [:i.fa.fa-remove] (t :badge/Declineendorsement)]]]]
               [:div.row.flip.buttons
                [:div.col-md-8 #_[:button.btn.btn-primary {:on-click #(do
                                                                        (.preventDefault %)
                                                                        (edit-endorsement id user_badge_id @(cursor params [:endorsement :content])))
                                                           :disabled (blank? @(cursor params [:endorsement :content]))
                                                           :data-dismiss "modal"

                                                           } (t :core/Save)]
                 [:button.btn.btn-warning.cancel {:data-dismiss "modal"} (t :core/Cancel)]]
                ;[:div.col-xs-12.delete-btn {:style {:margin "10px 0px 10px 0px" :cursor "pointer" :width "100%"}}
                [:div.col-md-4 [:a.delete-btn {:style {:line-height "4" :cursor "pointer"}
