For example, how do I perform these listener without falling back into imperative style cljs?
var cols = document.querySelectorAll('#columns .column');
[].forEach.call(cols, function(col) {
col.addEventListener('dragstart', handleDragStart, false);
col.addEventListener('dragenter', handleDragEnter, false);
col.addEventListener('dragover', handleDragOver, false);
col.addEventListener('dragleave', handleDragLeave, false);
});
Found this online: https://www.refheap.com/73581
(defn allow-drop [e]
(.preventDefault e)) ;; because DnD in HTMl5 is crazy...
:draggable true ; -> otherwise the browser won't let you drag it
:on-drag-over allow-drop
:on-drag-enter allow-drop
:on-drag-start #(.setData (.-dataTransfer %) "text/plain" "") ;; for Firefox. You MUST set something as data.
:on-drag-end some-action
:on-drop some-other-action
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With