-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
253 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/**! | ||
* Sortable 1.15.3 | ||
* Sortable 1.15.4 | ||
* @author RubaXa <[email protected]> | ||
* @author owenm <[email protected]> | ||
* @license MIT | ||
|
@@ -134,7 +134,7 @@ | |
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
|
||
var version = "1.15.3"; | ||
var version = "1.15.4"; | ||
|
||
function userAgent(pattern) { | ||
if (typeof window !== 'undefined' && window.navigator) { | ||
|
@@ -1238,7 +1238,7 @@ | |
pluginEvent('filter', _this, { | ||
evt: evt | ||
}); | ||
preventOnFilter && evt.cancelable && evt.preventDefault(); | ||
preventOnFilter && evt.preventDefault(); | ||
return; // cancel dnd | ||
} | ||
} else if (filter) { | ||
|
@@ -1260,7 +1260,7 @@ | |
} | ||
}); | ||
if (filter) { | ||
preventOnFilter && evt.cancelable && evt.preventDefault(); | ||
preventOnFilter && evt.preventDefault(); | ||
return; // cancel dnd | ||
} | ||
} | ||
|
@@ -1332,9 +1332,15 @@ | |
on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent); | ||
on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent); | ||
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent); | ||
on(ownerDocument, 'mouseup', _this._onDrop); | ||
on(ownerDocument, 'touchend', _this._onDrop); | ||
on(ownerDocument, 'touchcancel', _this._onDrop); | ||
if (options.supportPointer) { | ||
on(ownerDocument, 'pointerup', _this._onDrop); | ||
// Native D&D triggers pointercancel | ||
!this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop); | ||
} else { | ||
on(ownerDocument, 'mouseup', _this._onDrop); | ||
on(ownerDocument, 'touchend', _this._onDrop); | ||
on(ownerDocument, 'touchcancel', _this._onDrop); | ||
} | ||
|
||
// Make dragEl draggable (must be before delay for FireFox) | ||
if (FireFox && this.nativeDraggable) { | ||
|
@@ -1354,9 +1360,14 @@ | |
// If the user moves the pointer or let go the click or touch | ||
// before the delay has been reached: | ||
// disable the delayed drag | ||
on(ownerDocument, 'mouseup', _this._disableDelayedDrag); | ||
on(ownerDocument, 'touchend', _this._disableDelayedDrag); | ||
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); | ||
if (options.supportPointer) { | ||
on(ownerDocument, 'pointerup', _this._disableDelayedDrag); | ||
on(ownerDocument, 'pointercancel', _this._disableDelayedDrag); | ||
} else { | ||
on(ownerDocument, 'mouseup', _this._disableDelayedDrag); | ||
on(ownerDocument, 'touchend', _this._disableDelayedDrag); | ||
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); | ||
} | ||
on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler); | ||
on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler); | ||
options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler); | ||
|
@@ -1382,6 +1393,8 @@ | |
off(ownerDocument, 'mouseup', this._disableDelayedDrag); | ||
off(ownerDocument, 'touchend', this._disableDelayedDrag); | ||
off(ownerDocument, 'touchcancel', this._disableDelayedDrag); | ||
off(ownerDocument, 'pointerup', this._disableDelayedDrag); | ||
off(ownerDocument, 'pointercancel', this._disableDelayedDrag); | ||
off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler); | ||
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler); | ||
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler); | ||
|
@@ -1401,14 +1414,13 @@ | |
on(rootEl, 'dragstart', this._onDragStart); | ||
} | ||
try { | ||
if (document.selection) { | ||
// Timeout neccessary for IE9 | ||
_nextTick(function () { | ||
_nextTick(function () { | ||
if (document.selection) { | ||
document.selection.empty(); | ||
}); | ||
} else { | ||
window.getSelection().removeAllRanges(); | ||
} | ||
} else { | ||
window.getSelection().removeAllRanges(); | ||
} | ||
}); | ||
} catch (err) {} | ||
}, | ||
_dragStarted: function _dragStarted(fallback, evt) { | ||
|
@@ -1895,6 +1907,7 @@ | |
off(ownerDocument, 'mouseup', this._onDrop); | ||
off(ownerDocument, 'touchend', this._onDrop); | ||
off(ownerDocument, 'pointerup', this._onDrop); | ||
off(ownerDocument, 'pointercancel', this._onDrop); | ||
off(ownerDocument, 'touchcancel', this._onDrop); | ||
off(document, 'selectstart', this); | ||
}, | ||
|
@@ -3085,28 +3098,38 @@ | |
var lastIndex = index(lastMultiDragSelect), | ||
currentIndex = index(dragEl$1); | ||
if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { | ||
// Must include lastMultiDragSelect (select it), in case modified selection from no selection | ||
// (but previous selection existed) | ||
var n, i; | ||
if (currentIndex > lastIndex) { | ||
i = lastIndex; | ||
n = currentIndex; | ||
} else { | ||
i = currentIndex; | ||
n = lastIndex + 1; | ||
} | ||
for (; i < n; i++) { | ||
if (~multiDragElements.indexOf(children[i])) continue; | ||
toggleClass(children[i], options.selectedClass, true); | ||
multiDragElements.push(children[i]); | ||
dispatchEvent({ | ||
sortable: sortable, | ||
rootEl: rootEl, | ||
name: 'select', | ||
targetEl: children[i], | ||
originalEvent: evt | ||
}); | ||
} | ||
(function () { | ||
// Must include lastMultiDragSelect (select it), in case modified selection from no selection | ||
// (but previous selection existed) | ||
var n, i; | ||
if (currentIndex > lastIndex) { | ||
i = lastIndex; | ||
n = currentIndex; | ||
} else { | ||
i = currentIndex; | ||
n = lastIndex + 1; | ||
} | ||
var filter = options.filter; | ||
for (; i < n; i++) { | ||
if (~multiDragElements.indexOf(children[i])) continue; | ||
// Check if element is draggable | ||
if (!closest(children[i], options.draggable, parentEl, false)) continue; | ||
// Check if element is filtered | ||
var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) { | ||
return closest(children[i], criteria.trim(), parentEl, false); | ||
})); | ||
if (filtered) continue; | ||
toggleClass(children[i], options.selectedClass, true); | ||
multiDragElements.push(children[i]); | ||
dispatchEvent({ | ||
sortable: sortable, | ||
rootEl: rootEl, | ||
name: 'select', | ||
targetEl: children[i], | ||
originalEvent: evt | ||
}); | ||
} | ||
})(); | ||
} | ||
} else { | ||
lastMultiDragSelect = dragEl$1; | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/**! | ||
* Sortable 1.15.3 | ||
* Sortable 1.15.4 | ||
* @author RubaXa <[email protected]> | ||
* @author owenm <[email protected]> | ||
* @license MIT | ||
|
@@ -128,7 +128,7 @@ function _nonIterableSpread() { | |
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
|
||
var version = "1.15.3"; | ||
var version = "1.15.4"; | ||
|
||
function userAgent(pattern) { | ||
if (typeof window !== 'undefined' && window.navigator) { | ||
|
@@ -1232,7 +1232,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{ | |
pluginEvent('filter', _this, { | ||
evt: evt | ||
}); | ||
preventOnFilter && evt.cancelable && evt.preventDefault(); | ||
preventOnFilter && evt.preventDefault(); | ||
return; // cancel dnd | ||
} | ||
} else if (filter) { | ||
|
@@ -1254,7 +1254,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{ | |
} | ||
}); | ||
if (filter) { | ||
preventOnFilter && evt.cancelable && evt.preventDefault(); | ||
preventOnFilter && evt.preventDefault(); | ||
return; // cancel dnd | ||
} | ||
} | ||
|
@@ -1326,9 +1326,15 @@ Sortable.prototype = /** @lends Sortable.prototype */{ | |
on(ownerDocument, 'dragover', nearestEmptyInsertDetectEvent); | ||
on(ownerDocument, 'mousemove', nearestEmptyInsertDetectEvent); | ||
on(ownerDocument, 'touchmove', nearestEmptyInsertDetectEvent); | ||
on(ownerDocument, 'mouseup', _this._onDrop); | ||
on(ownerDocument, 'touchend', _this._onDrop); | ||
on(ownerDocument, 'touchcancel', _this._onDrop); | ||
if (options.supportPointer) { | ||
on(ownerDocument, 'pointerup', _this._onDrop); | ||
// Native D&D triggers pointercancel | ||
!this.nativeDraggable && on(ownerDocument, 'pointercancel', _this._onDrop); | ||
} else { | ||
on(ownerDocument, 'mouseup', _this._onDrop); | ||
on(ownerDocument, 'touchend', _this._onDrop); | ||
on(ownerDocument, 'touchcancel', _this._onDrop); | ||
} | ||
|
||
// Make dragEl draggable (must be before delay for FireFox) | ||
if (FireFox && this.nativeDraggable) { | ||
|
@@ -1348,9 +1354,14 @@ Sortable.prototype = /** @lends Sortable.prototype */{ | |
// If the user moves the pointer or let go the click or touch | ||
// before the delay has been reached: | ||
// disable the delayed drag | ||
on(ownerDocument, 'mouseup', _this._disableDelayedDrag); | ||
on(ownerDocument, 'touchend', _this._disableDelayedDrag); | ||
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); | ||
if (options.supportPointer) { | ||
on(ownerDocument, 'pointerup', _this._disableDelayedDrag); | ||
on(ownerDocument, 'pointercancel', _this._disableDelayedDrag); | ||
} else { | ||
on(ownerDocument, 'mouseup', _this._disableDelayedDrag); | ||
on(ownerDocument, 'touchend', _this._disableDelayedDrag); | ||
on(ownerDocument, 'touchcancel', _this._disableDelayedDrag); | ||
} | ||
on(ownerDocument, 'mousemove', _this._delayedDragTouchMoveHandler); | ||
on(ownerDocument, 'touchmove', _this._delayedDragTouchMoveHandler); | ||
options.supportPointer && on(ownerDocument, 'pointermove', _this._delayedDragTouchMoveHandler); | ||
|
@@ -1376,6 +1387,8 @@ Sortable.prototype = /** @lends Sortable.prototype */{ | |
off(ownerDocument, 'mouseup', this._disableDelayedDrag); | ||
off(ownerDocument, 'touchend', this._disableDelayedDrag); | ||
off(ownerDocument, 'touchcancel', this._disableDelayedDrag); | ||
off(ownerDocument, 'pointerup', this._disableDelayedDrag); | ||
off(ownerDocument, 'pointercancel', this._disableDelayedDrag); | ||
off(ownerDocument, 'mousemove', this._delayedDragTouchMoveHandler); | ||
off(ownerDocument, 'touchmove', this._delayedDragTouchMoveHandler); | ||
off(ownerDocument, 'pointermove', this._delayedDragTouchMoveHandler); | ||
|
@@ -1395,14 +1408,13 @@ Sortable.prototype = /** @lends Sortable.prototype */{ | |
on(rootEl, 'dragstart', this._onDragStart); | ||
} | ||
try { | ||
if (document.selection) { | ||
// Timeout neccessary for IE9 | ||
_nextTick(function () { | ||
_nextTick(function () { | ||
if (document.selection) { | ||
document.selection.empty(); | ||
}); | ||
} else { | ||
window.getSelection().removeAllRanges(); | ||
} | ||
} else { | ||
window.getSelection().removeAllRanges(); | ||
} | ||
}); | ||
} catch (err) {} | ||
}, | ||
_dragStarted: function _dragStarted(fallback, evt) { | ||
|
@@ -1889,6 +1901,7 @@ Sortable.prototype = /** @lends Sortable.prototype */{ | |
off(ownerDocument, 'mouseup', this._onDrop); | ||
off(ownerDocument, 'touchend', this._onDrop); | ||
off(ownerDocument, 'pointerup', this._onDrop); | ||
off(ownerDocument, 'pointercancel', this._onDrop); | ||
off(ownerDocument, 'touchcancel', this._onDrop); | ||
off(document, 'selectstart', this); | ||
}, | ||
|
@@ -3079,28 +3092,38 @@ function MultiDragPlugin() { | |
var lastIndex = index(lastMultiDragSelect), | ||
currentIndex = index(dragEl$1); | ||
if (~lastIndex && ~currentIndex && lastIndex !== currentIndex) { | ||
// Must include lastMultiDragSelect (select it), in case modified selection from no selection | ||
// (but previous selection existed) | ||
var n, i; | ||
if (currentIndex > lastIndex) { | ||
i = lastIndex; | ||
n = currentIndex; | ||
} else { | ||
i = currentIndex; | ||
n = lastIndex + 1; | ||
} | ||
for (; i < n; i++) { | ||
if (~multiDragElements.indexOf(children[i])) continue; | ||
toggleClass(children[i], options.selectedClass, true); | ||
multiDragElements.push(children[i]); | ||
dispatchEvent({ | ||
sortable: sortable, | ||
rootEl: rootEl, | ||
name: 'select', | ||
targetEl: children[i], | ||
originalEvent: evt | ||
}); | ||
} | ||
(function () { | ||
// Must include lastMultiDragSelect (select it), in case modified selection from no selection | ||
// (but previous selection existed) | ||
var n, i; | ||
if (currentIndex > lastIndex) { | ||
i = lastIndex; | ||
n = currentIndex; | ||
} else { | ||
i = currentIndex; | ||
n = lastIndex + 1; | ||
} | ||
var filter = options.filter; | ||
for (; i < n; i++) { | ||
if (~multiDragElements.indexOf(children[i])) continue; | ||
// Check if element is draggable | ||
if (!closest(children[i], options.draggable, parentEl, false)) continue; | ||
// Check if element is filtered | ||
var filtered = filter && (typeof filter === 'function' ? filter.call(sortable, evt, children[i], sortable) : filter.split(',').some(function (criteria) { | ||
return closest(children[i], criteria.trim(), parentEl, false); | ||
})); | ||
if (filtered) continue; | ||
toggleClass(children[i], options.selectedClass, true); | ||
multiDragElements.push(children[i]); | ||
dispatchEvent({ | ||
sortable: sortable, | ||
rootEl: rootEl, | ||
name: 'select', | ||
targetEl: children[i], | ||
originalEvent: evt | ||
}); | ||
} | ||
})(); | ||
} | ||
} else { | ||
lastMultiDragSelect = dragEl$1; | ||
|
Oops, something went wrong.