dragon-drop
dragon-drop copied to clipboard
Feature Request: Support for ng2-dragula
I'm working on an project that uses Angular 6 and would like to use this library for the keyboard interactions, and the Angular 2 bridge for dragula for the mouse interactions (ie. ng2-dragula
).
In my project, I have a list of items that are sorted by a position
property. When you re-order the items on the list, via dragging an item with the mouse or keyboard, the position
property for all the items in the array is updated.
ng2-dragula
has a new event available in the service called dropModel
; an observable that sends over a few properties, most notably the targetModel
, so I can easily update the positions of each item in the array. This takes care of the above paragraph for mouse interactions.
However, I'm struggling a bit when using this library to figure out how to do this for the keyboard interactions. I have some ideas for features that could make this easier:
- Include the array of items in the
.on('dropped')
callback function, so that there's some way to determine new positions with the dropped item. - Add a property to the options object that lets you pass in the dragula/drake instance created with
ng2-dragula
. As it stands now, I think I'm creating two - one with your lib, and one withng2-dragula
. Not sure this would solve my problem with the keyboard events though. - Other?
Please let me know if there is something I'm missing or any other ideas you may have.
@lcecil Let me look into this and get back to you as I am not familiar with this Angular 2 bridge for dragula. As for your idea 1
(Include the array of items in the .on('dropped') callback function) - this can easily be done and I'm happy to add support for this.
Thanks, I appreciate it.
Idea 1 would be a great interim solution, when you have the time to implement that. Right now I'm hooking into the reorder
function of the announcement
object, but that definitely doesn't seem like the intended purpose.
Also wanted to say thanks for being so responsive and building this lib in the first place! It's excellent.