Skip to content

Commit

Permalink
Update core.cljs
Browse files Browse the repository at this point in the history
  • Loading branch information
bonuoq authored Dec 29, 2023
1 parent 08817c0 commit b74ed57
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@
:cm #(aget js/klipse-editors 0)
:res #(aget js/klipse-results 0)}}}))

(defn append-editor [& {:keys [id mode attrs snippet klipsettings] :or {mode "eval-clojure" klipsettings {}} :as varkeyargs}]
(defn append-editor [& {:keys [mode attrs snippet klipsettings] :or {mode "eval-clojure" klipsettings {}} :as varkeyargs}]
(let [div (gdom/createDom "div" (clj->js attrs) (gdom/createTextNode (str snippet)))]
(gdom/insertSiblingAfter div js/klipse-container)
(klp/klipsify div klipsettings mode))
(let [c (count (@pou :editors))]
(swap! pou assoc-in [:editors (or id c)] (merge varkeyargs
{:idx c
:mode mode
:cm #(aget js/klipse-editors c)
:res #(aget js/klipse-results c)}))))

(swap! pou assoc-in
[:editors (or (:id attrs) c)]
(merge varkeyargs {:idx c
:mode mode
:cm #(aget js/klipse-editors c)
:res #(aget js/klipse-results c)}))))

(defn cm [k method & args]
(j/apply ((-> @pou :editors (get k) :cm)) method (clj->js args)))

Expand Down

0 comments on commit b74ed57

Please sign in to comment.