Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is support for html5 drag/drop api possible? #61

Open
tcoopman opened this issue Nov 25, 2017 · 6 comments
Open

Is support for html5 drag/drop api possible? #61

tcoopman opened this issue Nov 25, 2017 · 6 comments

Comments

@tcoopman
Copy link
Contributor

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

@OvermindDL1
Copy link
Owner

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.

@tcoopman
Copy link
Contributor Author

tcoopman commented Nov 29, 2017 via email

@jackalcooper
Copy link
Contributor

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!

@OvermindDL1
Copy link
Owner

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

@iogrt
Copy link

iogrt commented Aug 28, 2019

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

@OvermindDL1
Copy link
Owner

OvermindDL1 commented Aug 29, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants