OvermindDL1 / bucklescript-tea

TEA for Bucklescript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is support for html5 drag/drop api possible?

tcoopman opened this issue · comments

I was looking into doing some drag/drop with html5 (https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API) but this doesn't look possible yet?

Would it require a lot of effort? I guess that some work would be adding the attributes like draggable, ondragstart,... but I'm not sure how the event handlers could be implemented

Well it's possible even in user code, I've just not made an easy API for it yet since Elm did not have one yet and I've not needed one yet. ^.^;

Hmm, looks like it would just require a few new attributes and a couple of new events to massage the event data into something more useful, it looks pretty easy to do overall though, even in pure user code. I'd happily accept a PR adding such attributes and event handlers (or to spur discussion about them), looks quite easy to do. :-)

If it is something you really badly need and not able to PR it in or put it in your user code currently, I could probably get it done tomorrow morning?

The event that is coming through that adds the callback functions on it would probably just most simply be done by adding those events as possibly undefined members on the event object, so just a few lines added overall for everything.

If it is something you really badly need and not able to PR it in or put it in your user code currently, I could probably get it done tomorrow morning?

That's very kind of you! Wish one day I became super rich so I can sponsor you for consultancy!

That's very kind of you! Wish one day I became super rich so I can sponsor you for consultancy!

Lol, mostly just that if someone has a problem that needs resolved quickly, I like to help resolve it as fast as I really can. :-)

Really though, if there are any features that anyone needs Really Soon, don't hesitate to state how important it is that it gets done quickly (even better with use-cases! ^.^), I will prioritize it much higher in my stack of stuff to do. :-)

commented

Is there any update on this? I'm unable to find the drag events in the codebase.

This points to a bigger problem tho. As much as I love the clean syntax of not having to h("div"), having a function that would create an element / attribute by string would help out in these cases

Is there any update on this? I'm unable to find the drag events in the codebase.

I've never used drag/drop so I need it PR'd in by someone who knows how to use it. ^.^;

This points to a bigger problem tho. As much as I love the clean syntax of not having to h("div"), having a function that would create an element / attribute by string would help out in these cases

Uh, you already can though? That's what node is for, it is in fact what something like let div ?(key="") ?(unique="") props nodes = fullnode "" "div" key unique props nodes maps to, you are able to define your own elements, attributes via attribute, etc... etc... It all goes down to a base string mapping. Quite literally all of the things like div ... are just wrappers around the base functions for the vdom. :-)

In general they are used pretty excessively in componentized projects as well.