mirror of
https://github.com/processwire/processwire.git
synced 2025-08-26 08:04:38 +02:00
Fix issue processwire/processwire-issues#202 where the leave confirm box was appearing when it shouldn't, after saving after a file had been uploaded. Also added drag/drop protection so that if you accidentially drag/drop a file outside of the specified dropzone, it gets ignored, rather than loading the file in the browser.
This commit is contained in:
@@ -405,7 +405,7 @@ $(document).ready(function() {
|
||||
}, false);
|
||||
dropArea.addEventListener("dragenter", function() {
|
||||
$(this).addClass('ui-state-hover');
|
||||
$(this).closest('.Inputfield').addClass('pw-drag-in-file InputfieldStateConfirmLeave');
|
||||
$(this).closest('.Inputfield').addClass('pw-drag-in-file');
|
||||
}, false);
|
||||
|
||||
dropArea.addEventListener("dragover", function (evt) {
|
||||
@@ -419,7 +419,7 @@ $(document).ready(function() {
|
||||
|
||||
dropArea.addEventListener("drop", function (evt) {
|
||||
traverseFiles(evt.dataTransfer.files);
|
||||
$(this).removeClass("ui-state-hover").closest('.Inputfield').removeClass('pw-drag-in-file InputfieldStateConfirmLeave');
|
||||
$(this).removeClass("ui-state-hover").closest('.Inputfield').removeClass('pw-drag-in-file');
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
}, false);
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1176,7 +1176,7 @@ function InputfieldImage($) {
|
||||
function dragStart() {
|
||||
if($inputfield.hasClass('pw-drag-in-file')) return;
|
||||
$el.addClass('ui-state-hover');
|
||||
$inputfield.addClass('pw-drag-in-file InputfieldStateConfirmLeave');
|
||||
$inputfield.addClass('pw-drag-in-file');
|
||||
}
|
||||
|
||||
function dragStop() {
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user