Skip to content

Instantly share code, notes, and snippets.

@dupuchba
Created March 16, 2017 19:21
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/be729574766b73064b306a3ae1f33ff7 to your computer and use it in GitHub Desktop.
Save dupuchba/be729574766b73064b306a3ae1f33ff7 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)
{:keys [on-drag-start]} (om/get-computed this)]
(dom/li #js {:draggable true
:title id
:onDragStart (fn [e]
(if (instance? js/HTMLLIElement (.-target e))
(let [dataTransfer (.-dataTransfer e)]
(set! (.-effectAllowed dataTransfer) "move")
(on-drag-start (om/get-ident this)))
(.preventDefault e)))
:onDragEnd (fn [e])}
text))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment