Created
March 16, 2017 19:21
-
-
Save dupuchba/be729574766b73064b306a3ae1f33ff7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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