Browse Source

Merge pull request #1106 from marvin659/dev

Fix drag and drop issue in "http://jsbin.com/fecaquk/edit?html,css,js
pull/867/merge
Lebedev Konstantin 8 years ago committed by GitHub
parent
commit
78b6f4dc37
  1. 21
      Sortable.js
  2. 3
      Sortable.min.js

21
Sortable.js

@ -384,7 +384,7 @@
dragEl = target; dragEl = target;
parentEl = dragEl.parentNode; parentEl = dragEl.parentNode;
nextEl = dragEl.nextSibling; nextEl = dragEl.nextSibling;
lastDownEl = target lastDownEl = target;
activeGroup = options.group; activeGroup = options.group;
oldIndex = startIndex; oldIndex = startIndex;
@ -476,11 +476,11 @@
} }
try { try {
if (document.selection) { if (document.selection) {
// Timeout neccessary for IE9 // Timeout neccessary for IE9
setTimeout(function () { setTimeout(function () {
document.selection.empty(); document.selection.empty();
}); });
} else { } else {
window.getSelection().removeAllRanges(); window.getSelection().removeAllRanges();
} }
@ -724,8 +724,13 @@
if ((el.children.length === 0) || (el.children[0] === ghostEl) || if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
(el === evt.target) && (target = _ghostIsLast(el, evt)) (el === evt.target) && (_ghostIsLast(el, evt))
) { ) {
//assign target only if condition is true
if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
target = el.lastElementChild;
}
if (target) { if (target) {
if (target.animated) { if (target.animated) {
return; return;
@ -1290,10 +1295,8 @@
// 5 — min delta // 5 — min delta
// abs — нельзя добавлять, а то глюки при наведении сверху // abs — нельзя добавлять, а то глюки при наведении сверху
return ( return (evt.clientY - (rect.top + rect.height) > 5) ||
(evt.clientY - (rect.top + rect.height) > 5) || (evt.clientX - (rect.left + rect.width) > 5);
(evt.clientX - (rect.right + rect.width) > 5)
) && lastEl;
} }

3
Sortable.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save