Skip to content

Commit

Permalink
Merge pull request #2072 from code4fan/master
Browse files Browse the repository at this point in the history
fix the drag position problem when existing non draggable elements at the end of the list
  • Loading branch information
owen-m1 authored Oct 3, 2021
2 parents b8940a9 + 6bf2914 commit daaefed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Sortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,12 @@ Sortable.prototype = /** @lends Sortable.prototype */ {

if (onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
capture();
el.appendChild(dragEl);
if (elLastChild && elLastChild.nextSibling) { // the last draggable element is not the last node
el.insertBefore(dragEl, elLastChild.nextSibling);
}
else {
el.appendChild(dragEl);
}
parentEl = el; // actualization

changed();
Expand Down

0 comments on commit daaefed

Please sign in to comment.