Prevent Firefox from opening dragged files outside drop zone
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d5db882e30
commit
93dcae84d3
1 changed files with 7 additions and 0 deletions
|
|
@ -2199,6 +2199,13 @@ function bookFileSelected(input) {
|
||||||
|
|
||||||
function initBookDropZone() {
|
function initBookDropZone() {
|
||||||
const zone = $('book-drop-zone');
|
const zone = $('book-drop-zone');
|
||||||
|
|
||||||
|
// Prevent Firefox from opening dragged files when dropped outside the zone
|
||||||
|
document.addEventListener('dragover', e => e.preventDefault());
|
||||||
|
document.addEventListener('drop', e => {
|
||||||
|
if (!zone || !zone.contains(e.target)) e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
if (!zone) return;
|
if (!zone) return;
|
||||||
|
|
||||||
zone.addEventListener('dragover', e => {
|
zone.addEventListener('dragover', e => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue