Browse Source

+ Check access

drag-over-refactoring
Lebedev Konstantin 8 years ago
parent
commit
27fcb06ef9
  1. 37
      Sortable.js

37
Sortable.js

@ -686,24 +686,31 @@
// Check base state
if (
!activeSortable ||
options.disabled ||
(evt.rootEl != null && evt.rootEl !== this.el) || // touch fallback
!activeSortable
!(evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
) {
return;
return; // exit
}
// Check access
if (isOwner) {
if (!canSort) {
// Reverting item into the original list
if (rootEl.contains(dragEl)) {
return; // exit
}
revert = true;
}
} else if (putSortable !== this) {
activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt);
if (!(activeSortable.lastPullMode || group.checkPut(this, activeSortable, dragEl, evt))) {
return; // exit;
}
}
if ((isOwner
? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
: (
putSortable === this ||
(
(activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
group.checkPut(this, activeSortable, dragEl, evt)
)
)
)
) {
// Smart auto-scrolling
_autoScroll(evt, options, this.el);
@ -729,7 +736,6 @@
return;
}
if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
(el === evt.target) && (target = _ghostIsLast(el, evt))
) {
@ -813,7 +819,6 @@
this._animate(targetRect, target);
}
}
}
},
_animate: function (prevRect, target) {

Loading…
Cancel
Save