...
This commit is contained in:
@@ -39,13 +39,17 @@ class FileTree {
|
||||
// Context menu
|
||||
this.container.addEventListener('contextmenu', (e) => {
|
||||
const node = e.target.closest('.tree-node');
|
||||
if (!node) return;
|
||||
|
||||
e.preventDefault();
|
||||
const path = node.dataset.path;
|
||||
const isDir = node.dataset.isdir === 'true';
|
||||
|
||||
window.showContextMenu(e.clientX, e.clientY, { path, isDir });
|
||||
|
||||
if (node) {
|
||||
// Clicked on a node
|
||||
const path = node.dataset.path;
|
||||
const isDir = node.dataset.isdir === 'true';
|
||||
window.showContextMenu(e.clientX, e.clientY, { path, isDir });
|
||||
} else if (e.target === this.container) {
|
||||
// Clicked on the empty space in the file tree container
|
||||
window.showContextMenu(e.clientX, e.clientY, { path: '', isDir: true });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user