Skip to content

Commit

Permalink
[js:core] fix Studio-42#1040 Uncaught TypeError when dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Jun 22, 2015
1 parent b8aedec commit 64f7c16
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion js/elFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,13 @@ window.elFinder = function(node, opts) {
**/
this.notifyDelay = this.options.notifyDelay > 0 ? parseInt(this.options.notifyDelay) : 500;

/**
* Dragging UI Helper object
*
* @type jQuery | null
**/
this.draggingUiHelper = null,

/**
* Base draggable options
*
Expand All @@ -538,6 +545,7 @@ window.elFinder = function(node, opts) {
start : function(e, ui) {
var targets = $.map(ui.helper.data('files')||[], function(h) { return h || null ;}),
cnt, h;
self.draggingUiHelper = ui.helper;
cnt = targets.length;
while (cnt--) {
h = targets[cnt];
Expand All @@ -547,13 +555,18 @@ window.elFinder = function(node, opts) {
}
}
},
stop : function() { self.trigger('focus').trigger('dragstop'); },
stop : function() {
self.draggingUiHelper = null;
self.trigger('focus').trigger('dragstop');
},
helper : function(e, ui) {
var element = this.id ? $(this) : $(this).parents('[id]:first'),
helper = $('<div class="elfinder-drag-helper"><span class="elfinder-drag-helper-icon-plus"/></div>'),
icon = function(mime) { return '<div class="elfinder-cwd-icon '+self.mime2class(mime)+' ui-corner-all"/>'; },
hashes, l;

self.draggingUiHelper && self.draggingUiHelper.stop(true, true);

self.trigger('dragstart', {target : element[0], originalEvent : e});

hashes = element.is('.'+self.res('class', 'cwdfile'))
Expand Down

0 comments on commit 64f7c16

Please sign in to comment.