Skip to content

Commit

Permalink
Re-create sortable every update. #1
Browse files Browse the repository at this point in the history
  • Loading branch information
chr15m committed Feb 2, 2019
1 parent 67ecdce commit 1f99f00
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/cljs/omgnata/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
(defonce todo-lists (atom {}))
(defonce todo-timestamps (atom {}))
(defonce last-timestamp (atom 0))
(defonce sorter (atom nil))

(def re-todo-finder #"[\ \t]*\*[\ \t]*\[(.*?)\]")
(def re-todo-parser #"[\ \t]*\*[\ \t]*\[(.*?)\][\ \t]*(.*?)[\n$]([\s\S]*)")
Expand Down Expand Up @@ -270,10 +271,14 @@

(defn apply-sortable [todos filename this]
(js/console.log "Sortable wrapping.")
(.create js/Sortable
(dom-node this)
#js {:handle ".handle"
:onEnd (partial finished-sorting-handler todos filename)}))
(when @sorter
(.call (aget @sorter "destroy") @sorter))
(reset! sorter
(.create js/Sortable
(dom-node this)
#js {:handle ".handle"
:animation 150
:onEnd (partial finished-sorting-handler todos filename)})))

(defn add-todo-list-handler [todos new-item add-mode ev]
(update-file @new-item (swap! todos assoc @new-item []))
Expand Down

0 comments on commit 1f99f00

Please sign in to comment.