Fix context menu and internal drops
This commit is contained in:
@@ -224,16 +224,19 @@ function renderExplorer(body, win) {
|
||||
row.addEventListener('dragover', (event) => {
|
||||
if (entry.type === 'directory') {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
event.dataTransfer.dropEffect = event.altKey ? 'copy' : 'move';
|
||||
}
|
||||
});
|
||||
row.addEventListener('drop', async (event) => {
|
||||
if (entry.type !== 'directory') return;
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
await handleDrop(event, win, entry.path);
|
||||
});
|
||||
row.addEventListener('contextmenu', (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
selectEntry(win, entry);
|
||||
showContextMenu(event, win, entry);
|
||||
});
|
||||
@@ -320,7 +323,7 @@ async function handleDrop(event, win, targetPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const internalPath = event.dataTransfer.getData('application/x-u-navigator-path');
|
||||
const internalPath = event.dataTransfer.getData('application/x-u-navigator-path') || event.dataTransfer.getData('text/plain');
|
||||
if (internalPath) {
|
||||
const name = internalPath.split('/').filter(Boolean).at(-1);
|
||||
const destination = `${targetPath.replace(/\/$/, '')}/${name}`;
|
||||
|
||||
Reference in New Issue
Block a user