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 // Check base state
if ( if (
!activeSortable ||
options.disabled || options.disabled ||
(evt.rootEl != null && evt.rootEl !== this.el) || // touch fallback !(evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
!activeSortable
) { ) {
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 // Smart auto-scrolling
_autoScroll(evt, options, this.el); _autoScroll(evt, options, this.el);
@ -729,7 +736,6 @@
return; return;
} }
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) && (target = _ghostIsLast(el, evt))
) { ) {
@ -813,7 +819,6 @@
this._animate(targetRect, target); this._animate(targetRect, target);
} }
} }
}
}, },
_animate: function (prevRect, target) { _animate: function (prevRect, target) {

Loading…
Cancel
Save