Skip to content

Commit

Permalink
#1046: fixed removing clone
Browse files Browse the repository at this point in the history
  • Loading branch information
RubaXa committed Feb 22, 2017
1 parent 3a99522 commit f485742
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,11 @@

ghostEl && ghostEl.parentNode.removeChild(ghostEl);

if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
// Remove clone
cloneEl && cloneEl.parentNode.removeChild(cloneEl);
}

if (dragEl) {
if (this.nativeDraggable) {
_off(dragEl, 'dragend', this);
Expand All @@ -905,7 +910,6 @@
newIndex = _index(dragEl, options.draggable);

if (newIndex >= 0) {

// Add event
_dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);

Expand All @@ -918,9 +922,6 @@
}
}
else {
// Remove clone
cloneEl && cloneEl.parentNode.removeChild(cloneEl);

if (dragEl.nextSibling !== nextEl) {
// Get the index of the dragged element within its parent
newIndex = _index(dragEl, options.draggable);
Expand Down

0 comments on commit f485742

Please sign in to comment.