Skip to content

Commit

Permalink
Fix drag-drop on site edges
Browse files Browse the repository at this point in the history
  • Loading branch information
Rewryte committed Nov 15, 2024
1 parent 1f789ef commit f8457b0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions dev/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ <h4 id="ModalTitle" class="modal-title"></h4>
}

// Drag and drop
document.getElementById( "Main" ).addEventListener( "drop", ( Event ) => {
document.addEventListener( "drop", ( Event ) => {
// URL or text dropped
const DragText = Event.dataTransfer.getData( "text/uri-list" ) || Event.dataTransfer.getData( "text/plain" );
if ( DragText ) {
Expand Down Expand Up @@ -404,11 +404,10 @@ <h4 id="ModalTitle" class="modal-title"></h4>
}

[ "dragenter", "dragover", "dragleave", "drop" ].forEach( EventName => {
document.getElementById( "Main" ).addEventListener( EventName, preventDefaults, false );
document.body.addEventListener( EventName, preventDefaults, false );
document.addEventListener( EventName, PreventDefaults, false );
});

function preventDefaults( e ) {
function PreventDefaults( e ) {
e.preventDefault();
e.stopPropagation();
}
Expand Down

0 comments on commit f8457b0

Please sign in to comment.