summaryrefslogtreecommitdiff
path: root/program/js/treelist.js
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-07-25 17:40:37 +0200
committerAleksander Machniak <alec@alec.pl>2014-07-25 17:40:37 +0200
commit2c0d3e1dd0a3df01c8adea0de5f2826f0bcb9434 (patch)
treeb31e1930c63e6f101ee5e8b946119f27fcb308bb /program/js/treelist.js
parent1e09be8a95779119a65c81045a65f62c6bff6c3b (diff)
Fix drag-n-drop after folder move/create (#1489648)
Diffstat (limited to 'program/js/treelist.js')
-rw-r--r--program/js/treelist.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/program/js/treelist.js b/program/js/treelist.js
index ab1363030..5071026f1 100644
--- a/program/js/treelist.js
+++ b/program/js/treelist.js
@@ -482,12 +482,14 @@ function rcube_treelist_widget(node, p)
if (keep_content) {
if (draggable_opts) {
- draggable('destroy');
+ if (ui_draggable)
+ draggable('destroy');
draggable(draggable_opts);
}
if (droppable_opts) {
- droppable('destroy');
+ if (ui_droppable)
+ droppable('destroy');
droppable(droppable_opts);
}
@@ -1061,6 +1063,9 @@ function rcube_treelist_widget(node, p)
if (!opts) opts = {};
if ($.type(opts) == 'string') {
+ if (opts == 'destroy') {
+ ui_droppable = null;
+ }
$('li:not(.virtual)', container).droppable(opts);
return this;
}
@@ -1109,6 +1114,9 @@ function rcube_treelist_widget(node, p)
if (!opts) opts = {};
if ($.type(opts) == 'string') {
+ if (opts == 'destroy') {
+ ui_draggable = null;
+ }
$('li:not(.virtual)', container).draggable(opts);
return this;
}
@@ -1121,6 +1129,7 @@ function rcube_treelist_widget(node, p)
iframeFix: true,
addClasses: false,
cursorAt: {left: -20, top: 5},
+ create: function(e, ui) { ui_draggable = ui; },
helper: function(e) {
return $('<div>').attr('id', 'rcmdraglayer')
.text($.trim($(e.target).first().text()));