launcher: allow dropping files into file fields

This commit is contained in:
jean-emmanuel 2024-02-21 10:30:52 +01:00
parent f78814ba45
commit fbfa41bd5a
2 changed files with 18 additions and 2 deletions

View file

@ -147,6 +147,21 @@ class Settings {
})
})
field.addEventListener('drop', (e) => {
e.preventDefault()
e.stopPropagation()
let paths = []
for (var f of event.dataTransfer.files) {
if (f.path.includes(' ')) {
paths.push('"' + f.path + '"')
} else {
paths.push(f.path)
}
}
input.value = paths.join(' ')
DOM.dispatchEvent(input, 'change')
});
}
reset = field.appendChild(html`