Skip to content

Commit babf6ab

Browse files
committed
1.15.0
1 parent 632d70b commit babf6ab

7 files changed

+101
-57
lines changed

Sortable.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.14.0
2+
* Sortable 1.15.0
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -166,7 +166,7 @@
166166
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
167167
}
168168

169-
var version = "1.14.0";
169+
var version = "1.15.0";
170170

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

11751175

1176-
if (documentExists) {
1176+
if (documentExists && !ChromeForAndroid) {
11771177
document.addEventListener('click', function (evt) {
11781178
if (ignoreNextClick) {
11791179
evt.preventDefault();
@@ -1792,6 +1792,7 @@
17921792

17931793
if (!Sortable.eventCanceled) {
17941794
cloneEl = clone(dragEl);
1795+
cloneEl.removeAttribute("id");
17951796
cloneEl.draggable = false;
17961797
cloneEl.style['will-change'] = '';
17971798

@@ -2033,7 +2034,14 @@
20332034

20342035
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
20352036
capture();
2036-
el.appendChild(dragEl);
2037+
2038+
if (elLastChild && elLastChild.nextSibling) {
2039+
// the last draggable element is not the last node
2040+
el.insertBefore(dragEl, elLastChild.nextSibling);
2041+
} else {
2042+
el.appendChild(dragEl);
2043+
}
2044+
20372045
parentEl = el; // actualization
20382046

20392047
changed();
@@ -3178,18 +3186,21 @@
31783186
}
31793187
}
31803188

3181-
if (sortable.options.supportPointer) {
3182-
on(document, 'pointerup', this._deselectMultiDrag);
3183-
} else {
3184-
on(document, 'mouseup', this._deselectMultiDrag);
3185-
on(document, 'touchend', this._deselectMultiDrag);
3189+
if (!sortable.options.avoidImplicitDeselect) {
3190+
if (sortable.options.supportPointer) {
3191+
on(document, 'pointerup', this._deselectMultiDrag);
3192+
} else {
3193+
on(document, 'mouseup', this._deselectMultiDrag);
3194+
on(document, 'touchend', this._deselectMultiDrag);
3195+
}
31863196
}
31873197

31883198
on(document, 'keydown', this._checkKeyDown);
31893199
on(document, 'keyup', this._checkKeyUp);
31903200
this.defaults = {
31913201
selectedClass: 'sortable-selected',
31923202
multiDragKey: null,
3203+
avoidImplicitDeselect: false,
31933204
setData: function setData(dataTransfer, dragEl) {
31943205
var data = '';
31953206

@@ -3480,7 +3491,7 @@
34803491
rootEl: rootEl,
34813492
name: 'select',
34823493
targetEl: dragEl$1,
3483-
originalEvt: evt
3494+
originalEvent: evt
34843495
}); // Modifier activated, select from last to dragEl
34853496

34863497
if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
@@ -3509,7 +3520,7 @@
35093520
rootEl: rootEl,
35103521
name: 'select',
35113522
targetEl: children[i],
3512-
originalEvt: evt
3523+
originalEvent: evt
35133524
});
35143525
}
35153526
}
@@ -3526,7 +3537,7 @@
35263537
rootEl: rootEl,
35273538
name: 'deselect',
35283539
targetEl: dragEl$1,
3529-
originalEvt: evt
3540+
originalEvent: evt
35303541
});
35313542
}
35323543
} // Multi-drag drop
@@ -3637,7 +3648,7 @@
36373648
rootEl: this.sortable.el,
36383649
name: 'deselect',
36393650
targetEl: el,
3640-
originalEvt: evt
3651+
originalEvent: evt
36413652
});
36423653
}
36433654
},

Sortable.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modular/sortable.complete.esm.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.14.0
2+
* Sortable 1.15.0
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -160,7 +160,7 @@ function _nonIterableSpread() {
160160
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
161161
}
162162

163-
var version = "1.14.0";
163+
var version = "1.15.0";
164164

165165
function userAgent(pattern) {
166166
if (typeof window !== 'undefined' && window.navigator) {
@@ -1167,7 +1167,7 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
11671167
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
11681168

11691169

1170-
if (documentExists) {
1170+
if (documentExists && !ChromeForAndroid) {
11711171
document.addEventListener('click', function (evt) {
11721172
if (ignoreNextClick) {
11731173
evt.preventDefault();
@@ -1786,6 +1786,7 @@ Sortable.prototype =
17861786

17871787
if (!Sortable.eventCanceled) {
17881788
cloneEl = clone(dragEl);
1789+
cloneEl.removeAttribute("id");
17891790
cloneEl.draggable = false;
17901791
cloneEl.style['will-change'] = '';
17911792

@@ -2027,7 +2028,14 @@ Sortable.prototype =
20272028

20282029
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
20292030
capture();
2030-
el.appendChild(dragEl);
2031+
2032+
if (elLastChild && elLastChild.nextSibling) {
2033+
// the last draggable element is not the last node
2034+
el.insertBefore(dragEl, elLastChild.nextSibling);
2035+
} else {
2036+
el.appendChild(dragEl);
2037+
}
2038+
20312039
parentEl = el; // actualization
20322040

20332041
changed();
@@ -3172,18 +3180,21 @@ function MultiDragPlugin() {
31723180
}
31733181
}
31743182

3175-
if (sortable.options.supportPointer) {
3176-
on(document, 'pointerup', this._deselectMultiDrag);
3177-
} else {
3178-
on(document, 'mouseup', this._deselectMultiDrag);
3179-
on(document, 'touchend', this._deselectMultiDrag);
3183+
if (!sortable.options.avoidImplicitDeselect) {
3184+
if (sortable.options.supportPointer) {
3185+
on(document, 'pointerup', this._deselectMultiDrag);
3186+
} else {
3187+
on(document, 'mouseup', this._deselectMultiDrag);
3188+
on(document, 'touchend', this._deselectMultiDrag);
3189+
}
31803190
}
31813191

31823192
on(document, 'keydown', this._checkKeyDown);
31833193
on(document, 'keyup', this._checkKeyUp);
31843194
this.defaults = {
31853195
selectedClass: 'sortable-selected',
31863196
multiDragKey: null,
3197+
avoidImplicitDeselect: false,
31873198
setData: function setData(dataTransfer, dragEl) {
31883199
var data = '';
31893200

@@ -3474,7 +3485,7 @@ function MultiDragPlugin() {
34743485
rootEl: rootEl,
34753486
name: 'select',
34763487
targetEl: dragEl$1,
3477-
originalEvt: evt
3488+
originalEvent: evt
34783489
}); // Modifier activated, select from last to dragEl
34793490

34803491
if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
@@ -3503,7 +3514,7 @@ function MultiDragPlugin() {
35033514
rootEl: rootEl,
35043515
name: 'select',
35053516
targetEl: children[i],
3506-
originalEvt: evt
3517+
originalEvent: evt
35073518
});
35083519
}
35093520
}
@@ -3520,7 +3531,7 @@ function MultiDragPlugin() {
35203531
rootEl: rootEl,
35213532
name: 'deselect',
35223533
targetEl: dragEl$1,
3523-
originalEvt: evt
3534+
originalEvent: evt
35243535
});
35253536
}
35263537
} // Multi-drag drop
@@ -3631,7 +3642,7 @@ function MultiDragPlugin() {
36313642
rootEl: this.sortable.el,
36323643
name: 'deselect',
36333644
targetEl: el,
3634-
originalEvt: evt
3645+
originalEvent: evt
36353646
});
36363647
}
36373648
},

modular/sortable.core.esm.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**!
2-
* Sortable 1.14.0
2+
* Sortable 1.15.0
33
* @author RubaXa <[email protected]>
44
* @author owenm <[email protected]>
55
* @license MIT
@@ -160,7 +160,7 @@ function _nonIterableSpread() {
160160
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
161161
}
162162

163-
var version = "1.14.0";
163+
var version = "1.15.0";
164164

165165
function userAgent(pattern) {
166166
if (typeof window !== 'undefined' && window.navigator) {
@@ -1167,7 +1167,7 @@ _detectNearestEmptySortable = function _detectNearestEmptySortable(x, y) {
11671167
}; // #1184 fix - Prevent click event on fallback if dragged but item not changed position
11681168

11691169

1170-
if (documentExists) {
1170+
if (documentExists && !ChromeForAndroid) {
11711171
document.addEventListener('click', function (evt) {
11721172
if (ignoreNextClick) {
11731173
evt.preventDefault();
@@ -1786,6 +1786,7 @@ Sortable.prototype =
17861786

17871787
if (!Sortable.eventCanceled) {
17881788
cloneEl = clone(dragEl);
1789+
cloneEl.removeAttribute("id");
17891790
cloneEl.draggable = false;
17901791
cloneEl.style['will-change'] = '';
17911792

@@ -2027,7 +2028,14 @@ Sortable.prototype =
20272028

20282029
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) {
20292030
capture();
2030-
el.appendChild(dragEl);
2031+
2032+
if (elLastChild && elLastChild.nextSibling) {
2033+
// the last draggable element is not the last node
2034+
el.insertBefore(dragEl, elLastChild.nextSibling);
2035+
} else {
2036+
el.appendChild(dragEl);
2037+
}
2038+
20312039
parentEl = el; // actualization
20322040

20332041
changed();
@@ -3174,18 +3182,21 @@ function MultiDragPlugin() {
31743182
}
31753183
}
31763184

3177-
if (sortable.options.supportPointer) {
3178-
on(document, 'pointerup', this._deselectMultiDrag);
3179-
} else {
3180-
on(document, 'mouseup', this._deselectMultiDrag);
3181-
on(document, 'touchend', this._deselectMultiDrag);
3185+
if (!sortable.options.avoidImplicitDeselect) {
3186+
if (sortable.options.supportPointer) {
3187+
on(document, 'pointerup', this._deselectMultiDrag);
3188+
} else {
3189+
on(document, 'mouseup', this._deselectMultiDrag);
3190+
on(document, 'touchend', this._deselectMultiDrag);
3191+
}
31823192
}
31833193

31843194
on(document, 'keydown', this._checkKeyDown);
31853195
on(document, 'keyup', this._checkKeyUp);
31863196
this.defaults = {
31873197
selectedClass: 'sortable-selected',
31883198
multiDragKey: null,
3199+
avoidImplicitDeselect: false,
31893200
setData: function setData(dataTransfer, dragEl) {
31903201
var data = '';
31913202

@@ -3476,7 +3487,7 @@ function MultiDragPlugin() {
34763487
rootEl: rootEl,
34773488
name: 'select',
34783489
targetEl: dragEl$1,
3479-
originalEvt: evt
3490+
originalEvent: evt
34803491
}); // Modifier activated, select from last to dragEl
34813492

34823493
if (evt.shiftKey && lastMultiDragSelect && sortable.el.contains(lastMultiDragSelect)) {
@@ -3505,7 +3516,7 @@ function MultiDragPlugin() {
35053516
rootEl: rootEl,
35063517
name: 'select',
35073518
targetEl: children[i],
3508-
originalEvt: evt
3519+
originalEvent: evt
35093520
});
35103521
}
35113522
}
@@ -3522,7 +3533,7 @@ function MultiDragPlugin() {
35223533
rootEl: rootEl,
35233534
name: 'deselect',
35243535
targetEl: dragEl$1,
3525-
originalEvt: evt
3536+
originalEvent: evt
35263537
});
35273538
}
35283539
} // Multi-drag drop
@@ -3633,7 +3644,7 @@ function MultiDragPlugin() {
36333644
rootEl: this.sortable.el,
36343645
name: 'deselect',
36353646
targetEl: el,
3636-
originalEvt: evt
3647+
originalEvent: evt
36373648
});
36383649
}
36393650
},

0 commit comments

Comments
 (0)