|
|
@ -20,7 +20,7 @@ |
|
|
|
})(function sortableFactory() { |
|
|
|
})(function sortableFactory() { |
|
|
|
"use strict"; |
|
|
|
"use strict"; |
|
|
|
|
|
|
|
|
|
|
|
if (typeof window == "undefined" || !window.document) { |
|
|
|
if (typeof window === "undefined" || !window.document) { |
|
|
|
return function sortableError() { |
|
|
|
return function sortableError() { |
|
|
|
throw new Error("Sortable.js requires a window with a document"); |
|
|
|
throw new Error("Sortable.js requires a window with a document"); |
|
|
|
}; |
|
|
|
}; |
|
|
@ -64,13 +64,14 @@ |
|
|
|
win = window, |
|
|
|
win = window, |
|
|
|
document = win.document, |
|
|
|
document = win.document, |
|
|
|
parseInt = win.parseInt, |
|
|
|
parseInt = win.parseInt, |
|
|
|
|
|
|
|
setTimeout = win.setTimeout, |
|
|
|
|
|
|
|
|
|
|
|
$ = win.jQuery || win.Zepto, |
|
|
|
$ = win.jQuery || win.Zepto, |
|
|
|
Polymer = win.Polymer, |
|
|
|
Polymer = win.Polymer, |
|
|
|
|
|
|
|
|
|
|
|
captureMode = false, |
|
|
|
captureMode = false, |
|
|
|
|
|
|
|
|
|
|
|
supportDraggable = !!('draggable' in document.createElement('div')), |
|
|
|
supportDraggable = ('draggable' in document.createElement('div')), |
|
|
|
supportCssPointerEvents = (function (el) { |
|
|
|
supportCssPointerEvents = (function (el) { |
|
|
|
// false when IE11
|
|
|
|
// false when IE11
|
|
|
|
if (!!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie)/i)) { |
|
|
|
if (!!navigator.userAgent.match(/(?:Trident.*rv[ :]?11\.|msie)/i)) { |
|
|
@ -485,7 +486,7 @@ |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (document.selection) { |
|
|
|
if (document.selection) { |
|
|
|
// Timeout neccessary for IE9
|
|
|
|
// Timeout neccessary for IE9
|
|
|
|
setTimeout(function () { |
|
|
|
_nextTick(function () { |
|
|
|
document.selection.empty(); |
|
|
|
document.selection.empty(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -625,8 +626,9 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
_onDragStart: function (/**Event*/evt, /**boolean*/useFallback) { |
|
|
|
_onDragStart: function (/**Event*/evt, /**boolean*/useFallback) { |
|
|
|
var dataTransfer = evt.dataTransfer, |
|
|
|
var _this = this; |
|
|
|
options = this.options; |
|
|
|
var dataTransfer = evt.dataTransfer; |
|
|
|
|
|
|
|
var options = this.options; |
|
|
|
|
|
|
|
|
|
|
|
this._offUpEvents(); |
|
|
|
this._offUpEvents(); |
|
|
|
|
|
|
|
|
|
|
@ -639,8 +641,11 @@ |
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
_css(cloneEl, 'display', 'none'); |
|
|
|
_toggleClass(cloneEl, this.options.chosenClass, false); |
|
|
|
_toggleClass(cloneEl, this.options.chosenClass, false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #1143: IFrame support workaround
|
|
|
|
|
|
|
|
_nextTick(function () { |
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
rootEl.insertBefore(cloneEl, dragEl); |
|
|
|
_dispatchEvent(this, rootEl, 'clone', dragEl); |
|
|
|
_dispatchEvent(_this, rootEl, 'clone', dragEl); |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_toggleClass(dragEl, options.dragClass, true); |
|
|
|
_toggleClass(dragEl, options.dragClass, true); |
|
|
@ -668,7 +673,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_on(document, 'drop', this); |
|
|
|
_on(document, 'drop', this); |
|
|
|
setTimeout(this._dragStarted, 0); |
|
|
|
_nextTick(this._dragStarted); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -1446,6 +1451,10 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _nextTick(fn) { |
|
|
|
|
|
|
|
setTimeout(fn, 0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Fixed #973:
|
|
|
|
// Fixed #973:
|
|
|
|
_on(document, 'touchmove', function (evt) { |
|
|
|
_on(document, 'touchmove', function (evt) { |
|
|
|
if (Sortable.active) { |
|
|
|
if (Sortable.active) { |
|
|
@ -1478,7 +1487,8 @@ |
|
|
|
closest: _closest, |
|
|
|
closest: _closest, |
|
|
|
toggleClass: _toggleClass, |
|
|
|
toggleClass: _toggleClass, |
|
|
|
clone: _clone, |
|
|
|
clone: _clone, |
|
|
|
index: _index |
|
|
|
index: _index, |
|
|
|
|
|
|
|
nextTick: _nextTick |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|