JS display paste-upload errors directly

This commit is contained in:
Christoph Haas 2021-02-20 21:18:47 +01:00
parent aaf22a34fb
commit e5b867fc16

View file

@ -100,6 +100,7 @@ javascript:
if (file==null)
{
console.log("File was null. Strange.");
display_error('Maybe the image was too large.');
return;
}
var formData = new FormData();
@ -115,6 +116,7 @@ javascript:
error: function(xhr, txt, err)
{
console.log("AJAX file upload returned error: "+txt+" / "+err);
display_error('Did you copy a proper image into your clipboard?');
},
success: function(res)
{
@ -124,3 +126,9 @@ javascript:
}
});
}
function display_error(msg)
{
$('#messages').html(
'<div class="callout alert alert-callout-subtle radius">Sorry, pasting did not work.' + msg + '</div>')
}