Skip to content

Commit

Permalink
Prevent "calling draggable before initailization" errors
Browse files Browse the repository at this point in the history
Elastic skin disables dragging on folders list, so we have to check
if it's still draggable before we call draggable() again. Otherwise
it will throw an error.
  • Loading branch information
alecpl committed Dec 27, 2017
1 parent a2875cd commit 5f26d9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion program/js/app.js
Expand Up @@ -7121,7 +7121,9 @@ function rcube_webmail()
}

// disable drag-n-drop temporarily
this.subscription_list.draggable('destroy').droppable('destroy');
// some skins disable dragging in mobile mode, so we have to check if it is still draggable
if (this.subscription_list.is_draggable())
this.subscription_list.draggable('destroy').droppable('destroy');

var row, n, tmp, tmp_name, rowid, collator, pos, p, parent = '',
folders = [], list = [], slist = [],
Expand Down
6 changes: 6 additions & 0 deletions program/js/treelist.js
Expand Up @@ -89,6 +89,7 @@ function rcube_treelist_widget(node, p)
this.intersects = intersects;
this.droppable = droppable;
this.draggable = draggable;
this.is_draggable = is_draggable;
this.update = update_node;
this.insert = insert;
this.remove = remove;
Expand Down Expand Up @@ -1245,6 +1246,11 @@ function rcube_treelist_widget(node, p)

return this;
}

function is_draggable()
{
return !!ui_draggable;
}
}

// use event processing functions from Roundcube's rcube_event_engine
Expand Down

0 comments on commit 5f26d9b

Please sign in to comment.