 (ns flense-demo.app
   (:require [cljs.core.async :as async]
-            [flense.actions :refer [actions]]
+            [flense.actions :refer [default-actions]]
             [flense.actions.history :as hist]
-            flense.actions.clipboard
-            flense.actions.clojure
-            flense.actions.movement
-            flense.actions.paredit
             [flense.editor :refer [editor-view]]
             [flense.model :as model]
             [flense-demo.keymap :refer [keymap]]

                             '(defn greet [name] (str "Hello, " name "!")))]}}))

(defn bound-action [ev]
  (-> ev phalanges/key-set keymap (@actions)))

(defn handle-key [ev]
  (when-let [action (bound-action ev)]

  (when-let [action (bound-action ev)]
    (if (model/stringlike? form)
      ;; prevent all keybinds except those that end editing
      (contains? (:tags (meta action)) :end-text-editing)
      ;; prevent delete keybind unless text fully selected
      (or (not (contains? (:tags (meta action)) :remove))
          (fully-selected? (.-target ev))))))

(defn init []
