 (ns cljs-webrepl.core
   (:require
-   [clojure.string :as str :refer [blank? trim]]
+   [clojure.string :as str]
    [cljs.core.async :refer [chan close! timeout put!]]
    [cljsjs.clipboard :as clipboard]
    [reagent.core :as r :refer [atom]]

    (when (and (some? to-repl) (some? expression))
      (put! to-repl expression))))

(defn copy-to-clipboard [txt]
  (->> (js-obj "dataType" "text/plain" "data" txt)
       (new js/ClipboardEvent "copy")
       (js/document.dispatchEvent)))

(defn history-prev [{:keys [cursor history] :as state}]
  (let [c          (count history)

         :input ""))

(defn eval-input [state]
  (let [input (str/trim (:input @state))]
    (when-not (= "" input)
      (eval-str! input)
      (swap! state assoc :input ""))))
