How would you recommend dealing with drag/drop in reagent?
I probably want to use the goog.fx.DragDrop functionality and move nodes between parents (components)
However, reparenting like this seems like a great way to confuse react
(defn- ondrop [event]
(let [ti (.-element (.-dropTargetItem event))
si (.-element (.-dragSourceItem event))]
(set! (.-background (.-style ti)) "silver")
(dom/append ti (dom/removeNode si))))
rather I should be update the atom appropriately and redraw the component with a new node or not, which means the component needs to know that there are items to be rendered that won't be there to start with and so on. Seems a bit more complicated.
Thanks
Ritchie
The cleanest way to handle drag-and-drop is probably to change your "model" (i.e some state in an atom) when the drop event is triggered, so that some content is rendered in a new place rather than in the old.
I don't have any direct experience from goog.fx.DragDrop, though, so I can't say for sure how easy it is to adapt to a non-DOM-centric model like React's.
/dan
I have a reagent tab container, now, let's say i want to run some non reagent/react dom nodes as a page of the container, is that possible?
Then I could use reagent for structuring the ui for most of the ui, then switch it off, e.g. if I want to have a game in that part of the dom. Then I could do my drag/drop with impunity in that part of the dom.
Thanks for any info.
Ritchie
On Tuesday, February 18, 2014 3:40:30 PM UTC-3, Dan Holmsand wrote: