diff --git a/public/js/vendor/Sortable.js b/public/js/vendor/Sortable.js index f1d85de..edb4e1c 100644 --- a/public/js/vendor/Sortable.js +++ b/public/js/vendor/Sortable.js @@ -132,6 +132,12 @@ return elCSS.flexDirection === 'column' || elCSS.flexDirection === 'column-reverse' ? 'vertical' : 'horizontal'; } + if (child1 && firstChildCSS.float !== 'none') { + var touchingSideChild2 = firstChildCSS.float === 'left' ? 'left' : 'right'; + + return child2 && (secondChildCSS.clear === 'both' || secondChildCSS.clear === touchingSideChild2) ? + 'vertical' : 'horizontal'; + } return (child1 && ( firstChildCSS.display === 'block' || @@ -456,6 +462,7 @@ }, true); var nearestEmptyInsertDetectEvent = function(evt) { + evt = evt.touches ? evt.touches[0] : evt; if (dragEl) { var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); @@ -470,8 +477,9 @@ } }; // We do not want this to be triggered if completed (bubbling canceled), so only define it here - document.addEventListener('dragover', nearestEmptyInsertDetectEvent); - document.addEventListener('mousemove', nearestEmptyInsertDetectEvent); + _on(document, 'dragover', nearestEmptyInsertDetectEvent); + _on(document, 'mousemove', nearestEmptyInsertDetectEvent); + _on(document, 'touchmove', nearestEmptyInsertDetectEvent); /** * @class Sortable @@ -957,7 +965,6 @@ _onTouchMove: function (/**TouchEvent*/evt) { if (tapEvt) { - if (!evt.cancelable) return; var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, @@ -1695,9 +1702,9 @@ selector != null && ( selector[0] === '>' && el.parentNode === ctx && _matches(el, selector.substring(1)) || - _matches(el, selector) || - (includeCTX && el === ctx) - ) + _matches(el, selector) + ) || + includeCTX && el === ctx ) { return el; } @@ -1720,7 +1727,7 @@ function _globalDragOver(/**Event*/evt) { if (evt.dataTransfer) { - evt.dataTransfer.dropEffect = 'none'; + evt.dataTransfer.dropEffect = 'move'; } evt.cancelable && evt.preventDefault(); } @@ -1923,15 +1930,17 @@ } /** - * Gets the last child in the el, ignoring ghostEl + * Gets the last child in the el, ignoring ghostEl or invisible elements (clones) * @param {HTMLElement} el Parent element * @return {HTMLElement} The last child, ignoring ghostEl */ function _lastChild(el) { var last = el.lastElementChild; - if (last === ghostEl) { - last = el.children[el.childElementCount - 2]; + while (last === ghostEl || last.style.display === 'none') { + last = last.previousElementSibling; + + if (!last) break; } return last || null; @@ -1943,12 +1952,13 @@ mouseOnOppAxis = axis === 'vertical' ? evt.clientX : evt.clientY, targetS2 = axis === 'vertical' ? elRect.bottom : elRect.right, targetS1Opp = axis === 'vertical' ? elRect.left : elRect.top, - targetS2Opp = axis === 'vertical' ? elRect.right : elRect.bottom; + targetS2Opp = axis === 'vertical' ? elRect.right : elRect.bottom, + spacer = 10; return ( - mouseOnOppAxis > targetS1Opp && - mouseOnOppAxis < targetS2Opp && - mouseOnAxis > targetS2 + axis === 'vertical' ? + (mouseOnOppAxis > targetS2Opp + spacer || mouseOnOppAxis <= targetS2Opp && mouseOnAxis > targetS2 && mouseOnOppAxis >= targetS1Opp) : + (mouseOnAxis > targetS2 && mouseOnOppAxis > targetS1Opp || mouseOnAxis <= targetS2 && mouseOnOppAxis > targetS2Opp + spacer) ); } @@ -2334,6 +2344,6 @@ // Export - Sortable.version = '1.8.1'; + Sortable.version = '1.8.3'; return Sortable; }); \ No newline at end of file