Commit 2867b25e authored by xjm's avatar xjm

Issue #2177293 by droplet, swentel, nod_, korven, LewisNyman, xjm, neclimdul:...

Issue #2177293 by droplet, swentel, nod_, korven, LewisNyman, xjm, neclimdul: Drag and drop broken on touch enabled laptops
parent 2e62367c
......@@ -260,7 +260,6 @@ drupal.tabledrag:
misc/tabledrag.js: { weight: -1 }
dependencies:
- core/jquery
- core/modernizr
- core/drupal
- core/drupalSettings
- core/jquery.once
......
......@@ -236,14 +236,10 @@
// Add event bindings to the document. The self variable is passed along
// as event handlers do not have direct access to the tableDrag object.
if (Modernizr.touchevents) {
$(document).on('touchmove', function (event) { return self.dragRow(event.originalEvent.touches[0], self); });
$(document).on('touchend', function (event) { return self.dropRow(event.originalEvent.touches[0], self); });
}
else {
$(document).on('mousemove', function (event) { return self.dragRow(event, self); });
$(document).on('mouseup', function (event) { return self.dropRow(event, self); });
}
$(document).on('mousemove pointermove', function (event) { return self.dragRow(event, self); });
$(document).on('mouseup pointerup', function (event) { return self.dropRow(event, self); });
// React to localStorage event showing or hiding weight columns.
$(window).on('storage', $.proxy(function (e) {
......@@ -460,19 +456,13 @@
$item.find('td').eq(0).prepend(handle);
}
if (Modernizr.touchevents) {
handle.on('touchstart', function (event) {
handle.on('mousedown touchstart pointerdown', function (event) {
event.preventDefault();
if (event.originalEvent.type === 'touchstart') {
event = event.originalEvent.touches[0];
self.dragStart(event, self, item);
});
}
else {
handle.on('mousedown', function (event) {
event.preventDefault();
self.dragStart(event, self, item);
});
}
// Prevent the anchor tag from jumping us to the top of the page.
handle.on('click', function (e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment