Skip to content

Commit

Permalink
Added checks to drag-n-drop to handle miving file in and out of the t…
Browse files Browse the repository at this point in the history
…rash directory.
  • Loading branch information
BryanRumsey committed May 31, 2021
1 parent 69cba20 commit a1fb0d4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client/pages/file-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ let FileBrowser = PageView.extend({
if(op === 'move_node' && more && more.ref && more.ref.type && !(more.ref.type == 'folder' || more.ref.type == 'root')){
return false
}
if(op === 'move_node' && more && more.ref && more.ref.type && more.ref.type === 'folder'){
if(op === 'move_node' && more && more.ref && more.ref.original && path.dirname(more.ref.original._path).split("/").includes("trash")){
return false
}
if(op === 'move_node' && more && more.ref && more.ref.type && more.ref.type === 'folder' && more.ref.text !== "trash"){
if(!more.ref.state.loaded){
return false
}
Expand Down Expand Up @@ -110,6 +113,8 @@ let FileBrowser = PageView.extend({
node.original._path = path.join(newDir, file);
if(node.type === "folder") {
$('#models-jstree').jstree().refresh_node(node);
}else if(newDir.endsWith("trash") || oldPath.split("/").includes("trash")) {
$('#models-jstree').jstree().refresh_node(par);
}
},
error: function (err, response, body) {
Expand Down

0 comments on commit a1fb0d4

Please sign in to comment.