Skip to content

Commit

Permalink
Update OrderedListHelper.js
Browse files Browse the repository at this point in the history
Proposed fix for the opened issue: "Dragging same item in same ordered list causes duplicate #2".
  • Loading branch information
vc4u authored Jun 24, 2018
1 parent f0390d3 commit 63235ed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/aura/OrderedList/OrderedListHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,17 @@
event.preventDefault();
event.stopPropagation();

var targetOption = event.target;
if (targetOption !== undefined) {
while (targetOption !== undefined && targetOption.tagName !== 'li' && targetOption.tagName !== 'LI') {
targetOption = targetOption.parentElement;
}
}
var items = component.get("v.items");
var rawData = event.dataTransfer.getData('text');
var item = JSON.parse(rawData);
var receivingItem = this.getItem(event.target.id,items);
item = this.getItem(item.Id,items) || item;
var receivingItem = this.getItem(targetOption.id,items);
item = this.getItem(item.id,items) || item;

//no items in the list or item wasn't dropped on a list item
//possibly bad if there isn't a recieving item found but we are rearranging items
Expand Down

0 comments on commit 63235ed

Please sign in to comment.