Avoid custom drag data type
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
set -eu
|
||||
|
||||
PLUGIN="u-navigator"
|
||||
VERSION="0.2.8"
|
||||
VERSION="0.2.9"
|
||||
PKG_DIR="packages"
|
||||
WORK_DIR=".plugin-build"
|
||||
PKG_NAME="${PLUGIN}-${VERSION}.tgz"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+15
-4
@@ -242,8 +242,11 @@ function renderExplorer(body, win) {
|
||||
});
|
||||
row.addEventListener('dragstart', (event) => {
|
||||
state.draggedEntry = { path: entry.path, name: entry.name, sourceWindowId: win.id };
|
||||
event.dataTransfer.setData('application/x-u-navigator-path', entry.path);
|
||||
event.dataTransfer.setData('text/plain', entry.path);
|
||||
try {
|
||||
event.dataTransfer.setData('text/plain', entry.path);
|
||||
} catch {
|
||||
// Some WebKit builds reject programmatic drag data. App state is the primary channel.
|
||||
}
|
||||
event.dataTransfer.effectAllowed = 'copyMove';
|
||||
row.classList.add('dragging');
|
||||
});
|
||||
@@ -359,7 +362,7 @@ async function handleDrop(event, win, targetPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const internalPath = event.dataTransfer.getData('application/x-u-navigator-path') || event.dataTransfer.getData('text/plain') || state.draggedEntry?.path;
|
||||
const internalPath = state.draggedEntry?.path || safeGetDragText(event);
|
||||
if (internalPath) {
|
||||
const name = internalPath.split('/').filter(Boolean).at(-1);
|
||||
const destination = `${targetPath.replace(/\/$/, '')}/${name}`;
|
||||
@@ -402,7 +405,7 @@ async function reloadExplorerWindows(ids) {
|
||||
}
|
||||
|
||||
function hasDropPayload(event) {
|
||||
return Boolean(state.draggedEntry || event.dataTransfer?.types?.includes('Files') || event.dataTransfer?.types?.includes('application/x-u-navigator-path') || event.dataTransfer?.types?.includes('text/plain'));
|
||||
return Boolean(state.draggedEntry || event.dataTransfer?.types?.includes('Files') || event.dataTransfer?.types?.includes('text/plain'));
|
||||
}
|
||||
|
||||
function showError(error) {
|
||||
@@ -410,6 +413,14 @@ function showError(error) {
|
||||
alert(message);
|
||||
}
|
||||
|
||||
function safeGetDragText(event) {
|
||||
try {
|
||||
return event.dataTransfer.getData('text/plain');
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async function renameEntry(win, entry) {
|
||||
const nextName = prompt('Neuer Name', entry.name);
|
||||
if (!nextName || nextName === entry.name) {
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<!DOCTYPE PLUGIN [
|
||||
<!ENTITY name "u-navigator">
|
||||
<!ENTITY author "michael">
|
||||
<!ENTITY version "0.2.8">
|
||||
<!ENTITY version "0.2.9">
|
||||
<!ENTITY package "&name;-&version;.tgz">
|
||||
]>
|
||||
<PLUGIN name="&name;" author="&author;" version="&version;" pluginURL="https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/u-navigator.plg">
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<FILE Name="/boot/config/plugins/&name;/&package;">
|
||||
<URL>https://git.casaderoll.de/michael/Unraid-Navigator/raw/branch/main/packages/&package;</URL>
|
||||
<MD5>5e77298b9383a80c1ca8c27020b1d8b0</MD5>
|
||||
<MD5>a8f39d867d56be04d8645f0975440b0a</MD5>
|
||||
</FILE>
|
||||
|
||||
<FILE Run="/bin/bash">
|
||||
|
||||
Reference in New Issue
Block a user