swap clone and item
Problem:
Current, when using pull: 'clone', at least in the onEnd callback, the element being dragged is e.item while the element that stayed behind e.clone.
This means you're actually dragging the original, while a clone was created and left in place.
To me, this is counter-intuitive, and makes some implementations complicated (e.g. if the original element has some logic that should be kept). I'd suggest inverting this, or at least add another clone mode that has this more correct behaviour
Thanks for the library !!
Why does the API need to be changed? Why does the name of the property matter to the functionality of your app?
Also, I disagree, to me it seems more intuitive to be dragging the original and a clone is being created in it's place.
It's not only the name of the property, it's also that the original keeps all events/react bindings/etc, while the other one does not.
In my case, I use SortableJs to create elements from a to a specific location in
. The element in has some logic, while the element that is dropped does not. I have to manually swap the elements after a drop, which is not very elegant.Of course the point about it being counter-intuitive is personal, but I definitely think both cases should be supported (eg: pull: 'clone' and pull: 'clone-reversed').
I see. I will do this in a later update.
Ya, the clone is wrongly implemented because it does not clone the logic of the element.
Kind of related: #671
I see. I will do this in a later update.
@owen-m1 Did you got chance to look into this?
@smg99 Sorry I got a job and haven't had much time to look at Sortable. I can do it but I can't say when but if you want it soon it's best you try to do it yourself and I can answer any questions.
I'm also having a major issue with this because the bound eventlistener of the original item no longer works! This needs a fix asap imho. A workaround for this is now very ugly and hard to achieve :/
Edit: Actually i found a better way:
onAdd: function (evt) {
evt.clone.replaceWith(evt.item)
}
我也有一个主要问题,因为原始项目的绑定事件听觉器不再起作用!这需要尽快修复。解决这个问题的方法现在非常丑陋且难以实现:/
编辑:实际上我找到了更好的方法:
onAdd: function (evt) { evt.clone.replaceWith(evt.item) }
You're really great