Skip to content

Commit

Permalink
fixed issue with DND and worker causing nodes not to load - close #821
Browse files Browse the repository at this point in the history
  • Loading branch information
vakata committed Sep 9, 2014
1 parent 3689a82 commit 1793f02
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 38 deletions.
4 changes: 4 additions & 0 deletions demo/sitebrowser/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
try {
$rslt = null;
switch($_GET['operation']) {
case 'analyze':
var_dump($fs->analyze(true));
die();
break;
case 'get_node':
$node = isset($_GET['id']) && $_GET['id'] !== '#' ? (int)$_GET['id'] : 0;
$temp = $fs->get_children($node);
Expand Down
31 changes: 21 additions & 10 deletions dist/jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1613,18 +1613,18 @@
)
);
}
w = new window.Worker(this._wrk);
w.onmessage = $.proxy(function (e) {
rslt.call(this, e.data, true);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}, this);
if(!this._data.core.working || force_processing) {
this._data.core.working = true;
w = new window.Worker(this._wrk);
w.onmessage = $.proxy(function (e) {
rslt.call(this, e.data, true);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}, this);
if(!args.par) {
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
Expand All @@ -1643,6 +1643,12 @@
}
catch(e) {
rslt.call(this, func(args), false);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}
}
else {
Expand Down Expand Up @@ -5605,6 +5611,11 @@
}
}
lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos);
for(i = 0, j = nodes.length; i < j; i++) {
if(nodes[i].instance) {
nodes[i].instance = null;
}
}
}
else {
i = $(data.event.target).closest('.jstree');
Expand Down
6 changes: 3 additions & 3 deletions dist/jstree.min.js

Large diffs are not rendered by default.

31 changes: 21 additions & 10 deletions docs/assets/dist/jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1613,18 +1613,18 @@
)
);
}
w = new window.Worker(this._wrk);
w.onmessage = $.proxy(function (e) {
rslt.call(this, e.data, true);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}, this);
if(!this._data.core.working || force_processing) {
this._data.core.working = true;
w = new window.Worker(this._wrk);
w.onmessage = $.proxy(function (e) {
rslt.call(this, e.data, true);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}, this);
if(!args.par) {
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
Expand All @@ -1643,6 +1643,12 @@
}
catch(e) {
rslt.call(this, func(args), false);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}
}
else {
Expand Down Expand Up @@ -5605,6 +5611,11 @@
}
}
lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos);
for(i = 0, j = nodes.length; i < j; i++) {
if(nodes[i].instance) {
nodes[i].instance = null;
}
}
}
else {
i = $(data.event.target).closest('.jstree');
Expand Down
6 changes: 3 additions & 3 deletions docs/assets/dist/jstree.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/jstree.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/jstree.dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@
}
}
lastmv.ins[ data.data.origin && (data.data.origin.settings.dnd.always_copy || (data.data.origin.settings.dnd.copy && (data.event.metaKey || data.event.ctrlKey))) ? 'copy_node' : 'move_node' ](nodes, lastmv.par, lastmv.pos);
for(i = 0, j = nodes.length; i < j; i++) {
if(nodes[i].instance) {
nodes[i].instance = null;
}
}
}
else {
i = $(data.event.target).closest('.jstree');
Expand Down
26 changes: 16 additions & 10 deletions src/jstree.js
Original file line number Diff line number Diff line change
Expand Up @@ -1613,18 +1613,18 @@
)
);
}
w = new window.Worker(this._wrk);
w.onmessage = $.proxy(function (e) {
rslt.call(this, e.data, true);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}, this);
if(!this._data.core.working || force_processing) {
this._data.core.working = true;
w = new window.Worker(this._wrk);
w.onmessage = $.proxy(function (e) {
rslt.call(this, e.data, true);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}, this);
if(!args.par) {
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
Expand All @@ -1643,6 +1643,12 @@
}
catch(e) {
rslt.call(this, func(args), false);
if(this._data.core.worker_queue.length) {
this._append_json_data.apply(this, this._data.core.worker_queue.shift());
}
else {
this._data.core.working = false;
}
}
}
else {
Expand Down

0 comments on commit 1793f02

Please sign in to comment.