bucklescript-tea icon indicating copy to clipboard operation
bucklescript-tea copied to clipboard

Is support for html5 drag/drop api possible?

Open tcoopman opened this issue 7 years ago • 6 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

tcoopman avatar Nov 25 '17 19:11 tcoopman

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.

OvermindDL1 avatar Nov 28 '17 20:11 OvermindDL1

No pressure on it. If you have the time, you're free to take a look at it of course, but if not, I might try it myself. It won't be for right now though.

On Tue, 28 Nov 2017, 21:01 OvermindDL1, [email protected] wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OvermindDL1/bucklescript-tea/issues/61#issuecomment-347646145, or mute the thread https://github.com/notifications/unsubscribe-auth/AACx6rOjdys6Wdhaui14drHJPqwTJmDjks5s7GaggaJpZM4Qqhqj .

tcoopman avatar Nov 29 '17 06:11 tcoopman

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!

jackalcooper avatar Dec 01 '17 10:12 jackalcooper

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. :-)

OvermindDL1 avatar Dec 01 '17 15:12 OvermindDL1

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

iogrt avatar Aug 28 '19 09:08 iogrt

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.

OvermindDL1 avatar Aug 29 '19 17:08 OvermindDL1