Created
March 16, 2017 16:11
-
-
Save dupuchba/8166e9411800ee59e69f01099279c952 to your computer and use it in GitHub Desktop.
This file contains 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)] | |
(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