   )
 
 ;; add keyup listner to text-el
- (.addEventListener (get-text-el) "keyup" (fn []
+ (.addEventListener (get-text-el) "keyup" (fn [] ;; TODO only characters, not f.e. arrows
   (execute)
   ))
 
-
+(execute)
 
 
 
 (comment
+
+
+
 (defn render-query [results]
   (str
     "<ul>"

(ns ^:figwheel-always text-justification.core
    (:require [reagent.core :as reagent :refer [atom]]
              [goog.dom :as dom]))

(enable-console-print!)

(defonce text-id "text")
(defonce page-width 11)
(defonce target-el (dom/getElement "justified-text"))

(defn get-text-el []


(defn execute []
  (.log js/console "Execute !!!")
  (dom/removeChildren target-el)

  (let [strs (seq (.split (get-text) #" "))
    justified_lines (second (text_justification strs page-width))]
    ;;(print ">>" justified_lines)
    ;;(print "<<" strs)
    (doseq [line_strs justified_lines]
      (let [line (stretch_string line_strs page-width)
        el (.createElement js/document "div")]
        (println "line:" line)
        (.appendChild target-el el)
        (set! (.-innerText el) line)
        )))
  )


;; remove listeners from text area
