Skip to content

Commit

Permalink
1.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-m1 committed Jan 8, 2021
1 parent 5afb802 commit 8a987c0
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 31 deletions.
26 changes: 19 additions & 7 deletions Sortable.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.10.2
* Sortable 1.13.0
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -132,7 +132,7 @@
throw new TypeError("Invalid attempt to spread non-iterable instance");
}

var version = "1.10.2";
var version = "1.13.0";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -314,7 +314,7 @@
if (!el.getBoundingClientRect && el !== window) return;
var elRect, top, left, bottom, right, height, width;

if (el !== window && el !== getWindowScrollingElement()) {
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
elRect = el.getBoundingClientRect();
top = elRect.top;
left = elRect.left;
Expand Down Expand Up @@ -754,7 +754,7 @@
target.animatingX = !!translateX;
target.animatingY = !!translateY;
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
repaint(target); // repaint
this.forRepaintDummy = repaint(target); // repaint

css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
css(target, 'transform', 'translate3d(0,0,0)');
Expand Down Expand Up @@ -792,6 +792,11 @@
}
}

plugins.forEach(function (p) {
if (p.pluginName === plugin.pluginName) {
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
}
});
plugins.push(plugin);
},
pluginEvent: function pluginEvent(eventName, sortable, evt) {
Expand Down Expand Up @@ -1235,7 +1240,7 @@
x: 0,
y: 0
},
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
emptyInsertThreshold: 5
};
PluginManager.initializePlugins(this, el, defaults); // Set default options
Expand Down Expand Up @@ -1322,6 +1327,11 @@

if (originalTarget.isContentEditable) {
return;
} // Safari ignores further event handling after mousedown


if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
return;
}

target = closest(target, options.draggable, el, false);
Expand Down Expand Up @@ -2319,7 +2329,7 @@
* Sorts the elements according to the array.
* @param {String[]} order order of the items
*/
sort: function sort(order) {
sort: function sort(order, useAnimation) {
var items = {},
rootEl = this.el;
this.toArray().forEach(function (id, i) {
Expand All @@ -2329,12 +2339,14 @@
items[id] = el;
}
}, this);
useAnimation && this.captureAnimationState();
order.forEach(function (id) {
if (items[id]) {
rootEl.removeChild(items[id]);
rootEl.appendChild(items[id]);
}
});
useAnimation && this.animateAll();
},

/**
Expand Down Expand Up @@ -2433,7 +2445,7 @@
pluginEvent('showClone', this);
if (Sortable.eventCanceled) return; // show clone at dragEl or original position

if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
rootEl.insertBefore(cloneEl, dragEl);
} else if (nextEl) {
rootEl.insertBefore(cloneEl, nextEl);
Expand Down
4 changes: 2 additions & 2 deletions Sortable.min.js

Large diffs are not rendered by default.

26 changes: 19 additions & 7 deletions modular/sortable.complete.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.10.2
* Sortable 1.13.0
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -126,7 +126,7 @@ function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}

var version = "1.10.2";
var version = "1.13.0";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -308,7 +308,7 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
if (!el.getBoundingClientRect && el !== window) return;
var elRect, top, left, bottom, right, height, width;

if (el !== window && el !== getWindowScrollingElement()) {
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
elRect = el.getBoundingClientRect();
top = elRect.top;
left = elRect.left;
Expand Down Expand Up @@ -748,7 +748,7 @@ function AnimationStateManager() {
target.animatingX = !!translateX;
target.animatingY = !!translateY;
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
repaint(target); // repaint
this.forRepaintDummy = repaint(target); // repaint

css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
css(target, 'transform', 'translate3d(0,0,0)');
Expand Down Expand Up @@ -786,6 +786,11 @@ var PluginManager = {
}
}

plugins.forEach(function (p) {
if (p.pluginName === plugin.pluginName) {
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
}
});
plugins.push(plugin);
},
pluginEvent: function pluginEvent(eventName, sortable, evt) {
Expand Down Expand Up @@ -1229,7 +1234,7 @@ function Sortable(el, options) {
x: 0,
y: 0
},
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
emptyInsertThreshold: 5
};
PluginManager.initializePlugins(this, el, defaults); // Set default options
Expand Down Expand Up @@ -1316,6 +1321,11 @@ Sortable.prototype =

if (originalTarget.isContentEditable) {
return;
} // Safari ignores further event handling after mousedown


if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
return;
}

target = closest(target, options.draggable, el, false);
Expand Down Expand Up @@ -2313,7 +2323,7 @@ Sortable.prototype =
* Sorts the elements according to the array.
* @param {String[]} order order of the items
*/
sort: function sort(order) {
sort: function sort(order, useAnimation) {
var items = {},
rootEl = this.el;
this.toArray().forEach(function (id, i) {
Expand All @@ -2323,12 +2333,14 @@ Sortable.prototype =
items[id] = el;
}
}, this);
useAnimation && this.captureAnimationState();
order.forEach(function (id) {
if (items[id]) {
rootEl.removeChild(items[id]);
rootEl.appendChild(items[id]);
}
});
useAnimation && this.animateAll();
},

/**
Expand Down Expand Up @@ -2427,7 +2439,7 @@ Sortable.prototype =
pluginEvent('showClone', this);
if (Sortable.eventCanceled) return; // show clone at dragEl or original position

if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
rootEl.insertBefore(cloneEl, dragEl);
} else if (nextEl) {
rootEl.insertBefore(cloneEl, nextEl);
Expand Down
26 changes: 19 additions & 7 deletions modular/sortable.core.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.10.2
* Sortable 1.13.0
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -126,7 +126,7 @@ function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}

var version = "1.10.2";
var version = "1.13.0";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -308,7 +308,7 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
if (!el.getBoundingClientRect && el !== window) return;
var elRect, top, left, bottom, right, height, width;

if (el !== window && el !== getWindowScrollingElement()) {
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
elRect = el.getBoundingClientRect();
top = elRect.top;
left = elRect.left;
Expand Down Expand Up @@ -748,7 +748,7 @@ function AnimationStateManager() {
target.animatingX = !!translateX;
target.animatingY = !!translateY;
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
repaint(target); // repaint
this.forRepaintDummy = repaint(target); // repaint

css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
css(target, 'transform', 'translate3d(0,0,0)');
Expand Down Expand Up @@ -786,6 +786,11 @@ var PluginManager = {
}
}

plugins.forEach(function (p) {
if (p.pluginName === plugin.pluginName) {
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
}
});
plugins.push(plugin);
},
pluginEvent: function pluginEvent(eventName, sortable, evt) {
Expand Down Expand Up @@ -1229,7 +1234,7 @@ function Sortable(el, options) {
x: 0,
y: 0
},
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
emptyInsertThreshold: 5
};
PluginManager.initializePlugins(this, el, defaults); // Set default options
Expand Down Expand Up @@ -1316,6 +1321,11 @@ Sortable.prototype =

if (originalTarget.isContentEditable) {
return;
} // Safari ignores further event handling after mousedown


if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
return;
}

target = closest(target, options.draggable, el, false);
Expand Down Expand Up @@ -2313,7 +2323,7 @@ Sortable.prototype =
* Sorts the elements according to the array.
* @param {String[]} order order of the items
*/
sort: function sort(order) {
sort: function sort(order, useAnimation) {
var items = {},
rootEl = this.el;
this.toArray().forEach(function (id, i) {
Expand All @@ -2323,12 +2333,14 @@ Sortable.prototype =
items[id] = el;
}
}, this);
useAnimation && this.captureAnimationState();
order.forEach(function (id) {
if (items[id]) {
rootEl.removeChild(items[id]);
rootEl.appendChild(items[id]);
}
});
useAnimation && this.animateAll();
},

/**
Expand Down Expand Up @@ -2427,7 +2439,7 @@ Sortable.prototype =
pluginEvent('showClone', this);
if (Sortable.eventCanceled) return; // show clone at dragEl or original position

if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
rootEl.insertBefore(cloneEl, dragEl);
} else if (nextEl) {
rootEl.insertBefore(cloneEl, nextEl);
Expand Down
26 changes: 19 additions & 7 deletions modular/sortable.esm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**!
* Sortable 1.10.2
* Sortable 1.13.0
* @author RubaXa <[email protected]>
* @author owenm <[email protected]>
* @license MIT
Expand Down Expand Up @@ -126,7 +126,7 @@ function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance");
}

var version = "1.10.2";
var version = "1.13.0";

function userAgent(pattern) {
if (typeof window !== 'undefined' && window.navigator) {
Expand Down Expand Up @@ -308,7 +308,7 @@ function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoS
if (!el.getBoundingClientRect && el !== window) return;
var elRect, top, left, bottom, right, height, width;

if (el !== window && el !== getWindowScrollingElement()) {
if (el !== window && el.parentNode && el !== getWindowScrollingElement()) {
elRect = el.getBoundingClientRect();
top = elRect.top;
left = elRect.left;
Expand Down Expand Up @@ -748,7 +748,7 @@ function AnimationStateManager() {
target.animatingX = !!translateX;
target.animatingY = !!translateY;
css(target, 'transform', 'translate3d(' + translateX + 'px,' + translateY + 'px,0)');
repaint(target); // repaint
this.forRepaintDummy = repaint(target); // repaint

css(target, 'transition', 'transform ' + duration + 'ms' + (this.options.easing ? ' ' + this.options.easing : ''));
css(target, 'transform', 'translate3d(0,0,0)');
Expand Down Expand Up @@ -786,6 +786,11 @@ var PluginManager = {
}
}

plugins.forEach(function (p) {
if (p.pluginName === plugin.pluginName) {
throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once");
}
});
plugins.push(plugin);
},
pluginEvent: function pluginEvent(eventName, sortable, evt) {
Expand Down Expand Up @@ -1229,7 +1234,7 @@ function Sortable(el, options) {
x: 0,
y: 0
},
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window,
supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && !Safari,
emptyInsertThreshold: 5
};
PluginManager.initializePlugins(this, el, defaults); // Set default options
Expand Down Expand Up @@ -1316,6 +1321,11 @@ Sortable.prototype =

if (originalTarget.isContentEditable) {
return;
} // Safari ignores further event handling after mousedown


if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === 'SELECT') {
return;
}

target = closest(target, options.draggable, el, false);
Expand Down Expand Up @@ -2313,7 +2323,7 @@ Sortable.prototype =
* Sorts the elements according to the array.
* @param {String[]} order order of the items
*/
sort: function sort(order) {
sort: function sort(order, useAnimation) {
var items = {},
rootEl = this.el;
this.toArray().forEach(function (id, i) {
Expand All @@ -2323,12 +2333,14 @@ Sortable.prototype =
items[id] = el;
}
}, this);
useAnimation && this.captureAnimationState();
order.forEach(function (id) {
if (items[id]) {
rootEl.removeChild(items[id]);
rootEl.appendChild(items[id]);
}
});
useAnimation && this.animateAll();
},

/**
Expand Down Expand Up @@ -2427,7 +2439,7 @@ Sortable.prototype =
pluginEvent('showClone', this);
if (Sortable.eventCanceled) return; // show clone at dragEl or original position

if (rootEl.contains(dragEl) && !this.options.group.revertClone) {
if (dragEl.parentNode == rootEl && !this.options.group.revertClone) {
rootEl.insertBefore(cloneEl, dragEl);
} else if (nextEl) {
rootEl.insertBefore(cloneEl, nextEl);
Expand Down
Loading

0 comments on commit 8a987c0

Please sign in to comment.