Properly cleanup on drag end in treelist widget

pull/6669/head
Aleksander Machniak 6 years ago
parent 743794f1d8
commit b232886488

@ -1024,8 +1024,7 @@ function rcube_treelist_widget(node, p)
// enable auto-scrolling of list container // enable auto-scrolling of list container
if (container.height() > container.parent().height()) { if (container.height() > container.parent().height()) {
container.parent() container.parent().on('mousemove.treelist', function(e) {
.mousemove(function(e) {
var scroll = 0, var scroll = 0,
mouse = rcube_event.get_mouse_pos(e); mouse = rcube_event.get_mouse_pos(e);
mouse.y -= container.parent().offset().top; mouse.y -= container.parent().offset().top;
@ -1046,7 +1045,7 @@ function rcube_treelist_widget(node, p)
scroll_timer = null; scroll_timer = null;
} }
}) })
.mouseleave(function() { .on('mouseleave.treelist', function() {
if (scroll_timer) { if (scroll_timer) {
window.clearTimeout(scroll_timer); window.clearTimeout(scroll_timer);
scroll_timer = null; scroll_timer = null;
@ -1060,6 +1059,9 @@ function rcube_treelist_widget(node, p)
*/ */
function drag_end() function drag_end()
{ {
container.parent().off('.treelist');
$('li.droptarget', container).removeClass('droptarget');
if (!drag_active) if (!drag_active)
return; return;
@ -1071,8 +1073,6 @@ function rcube_treelist_widget(node, p)
autoexpand_timer = null; autoexpand_timer = null;
autoexpand_item = null; autoexpand_item = null;
} }
$('li.droptarget', container).removeClass('droptarget');
} }
/** /**

Loading…
Cancel
Save