1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-28 17:20:13 +02:00

Misc fixes for file explorer.

- Add validation while dropping a file
- Refactor removing file to work on path not reference
- style fixes
This commit is contained in:
Kushagra Gour
2018-10-12 23:53:36 +05:30
parent d3f06ac890
commit 57e41b2f4d
4 changed files with 36 additions and 19 deletions

View File

@@ -103,27 +103,27 @@ function File({
}, 1);
}
function dragStartHandler(e) {
console.log(file.path);
e.dataTransfer.setData('text/plain', file.path);
}
function dragOverHandler(e) {
if (file.isFolder) {
e.preventDefault();
e.target.classList.add('is-being-dragged-over');
e.target.style.outline = '1px dashed';
console.log(e.target);
e.currentTarget.classList.add('is-being-dragged-over');
e.currentTarget.style.outline = '1px dashed';
}
}
function dragLeaveHandler(e) {
if (file.isFolder) {
e.preventDefault();
e.target.style.outline = null;
e.currentTarget.style.outline = null;
}
}
function dropHandler(e) {
if (file.isFolder) {
e.preventDefault();
onFileDrop(e.dataTransfer.getData('text/plain'), file);
e.target.style.outline = null;
e.currentTarget.style.outline = null;
}
}
return (