Skip to content

Commit

Permalink
Update to SortableJS 1.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mschnitzer committed Mar 30, 2022
1 parent cbe052e commit 3008c7a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion sortablejs-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require_relative 'lib/sortablejs-rails.rb'
Gem::Specification.new do |s|
s.name = 'sortablejs-rails'
s.version = SortableJS::VERSION
s.date = '2021-12-22'
s.date = '2022-03-30'
s.summary = 'SortableJS for Ruby on Rails'
s.description = "A gem that provides the SortableJS library to Rails's asset pipeline."
s.authors = ['Manuel Schnitzer']
Expand Down
37 changes: 24 additions & 13 deletions vendor/assets/javascript/sortable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.14.0
* Sortable 1.15.0
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -166,7 +166,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.14.0";
var version = "1.15.0";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -1173,7 +1173,7 @@
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position


if (documentExists) {
if (documentExists && !ChromeForAndroid) {
document.addEventListener('click', function (evt) {
if (ignoreNextClick) {
evt.preventDefault();
Expand Down Expand Up @@ -1792,6 +1792,7 @@

if (!Sortable.eventCanceled) {
cloneEl = clone(dragEl);
cloneEl.removeAttribute("id");
cloneEl.draggable = false;
cloneEl.style['will-change'] = '';

Expand Down Expand Up @@ -2033,7 +2034,14 @@

if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
capture();
el.appendChild(dragEl);

if (elLastChild && elLastChild.nextSibling) {
// the last draggable element is not the last node
el.insertBefore(dragEl, elLastChild.nextSibling);
} else {
el.appendChild(dragEl);
}

parentEl = el; // actualization

changed();
Expand Down Expand Up @@ -3178,18 +3186,21 @@
}
}

if (sortable.options.supportPointer) {
on(document, 'pointerup', this._deselectMultiDrag);
} else {
on(document, 'mouseup', this._deselectMultiDrag);
on(document, 'touchend', this._deselectMultiDrag);
if (!sortable.options.avoidImplicitDeselect) {
if (sortable.options.supportPointer) {
on(document, 'pointerup', this._deselectMultiDrag);
} else {
on(document, 'mouseup', this._deselectMultiDrag);
on(document, 'touchend', this._deselectMultiDrag);
}
}

on(document, 'keydown', this._checkKeyDown);
on(document, 'keyup', this._checkKeyUp);
this.defaults = {
selectedClass: 'sortable-selected',
multiDragKey: null,
avoidImplicitDeselect: false,
setData: function setData(dataTransfer, dragEl) {
var data = '';

Expand Down Expand Up @@ -3480,7 +3491,7 @@
rootEl: rootEl,
name: 'select',
targetEl: dragEl$1,
originalEvt: evt
originalEvent: evt
}); // Modifier activated, select from last to dragEl

if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
Expand Down Expand Up @@ -3509,7 +3520,7 @@
rootEl: rootEl,
name: 'select',
targetEl: children[i],
originalEvt: evt
originalEvent: evt
});
}
}
Expand All @@ -3526,7 +3537,7 @@
rootEl: rootEl,
name: 'deselect',
targetEl: dragEl$1,
originalEvt: evt
originalEvent: evt
});
}
} // Multi-drag drop
Expand Down Expand Up @@ -3637,7 +3648,7 @@
rootEl: this.sortable.el,
name: 'deselect',
targetEl: el,
originalEvt: evt
originalEvent: evt
});
}
},
Expand Down
4 changes: 2 additions & 2 deletions vendor/assets/javascript/sortable.min.js

Large diffs are not rendered by default.

0 comments on commit 3008c7a

Please sign in to comment.