Skip to content

Instantly share code, notes, and snippets.

@dupuchba
Created March 16, 2017 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dupuchba/8166e9411800ee59e69f01099279c952 to your computer and use it in GitHub Desktop.
Save dupuchba/8166e9411800ee59e69f01099279c952 to your computer and use it in GitHub Desktop.
(defui Element
static om/Ident
(ident [this {:keys [id]}]
[:element/by-id id])
static om/IQuery
(query [this]
[:id :text])
Object
(render [this]
(let [{:keys [id text]} (om/props this)]
(dom/li #js {:draggable true
:onDragStart (fn [e]
(if (instance? js/HTMLLIElement (.-target e))
(let [dataTransfer (.-dataTransfer e)]
(set! (.-effectAllowed dataTransfer) "move")
;; Save that this element is being dragged
)
(.preventDefault e)))
:onDragEnd (fn [e]
;; Clear the saved information
)}
text))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment