Skip to content

Commit

Permalink
upload progress
Browse files Browse the repository at this point in the history
  • Loading branch information
bubenkoff committed Jun 21, 2023
1 parent 75d83ab commit 61ea565
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/js/bindings/fileupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ ko.bindingHandlers['fileupload'] = {
dataType: 'json',
dropZone: $parent.find('.mo-uploadzone')[0],
autoUpload: true,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
loadImageFileTypes: /^image\/(gif|jpe?g|png|webp)$/,
acceptFileTypes: /^image\/(gif|jpe?g|png|webp)$/,
maxFileSize: 10 * 1024 * 1024,
// Enable image resizing, except for Android and Opera,
// which actually support image resizing, but fail to
Expand Down Expand Up @@ -336,16 +337,18 @@ ko.bindingHandlers['fileupload'] = {
if (e.type == 'fileuploadprocessalways') {
var index = data.index,
file = data.files[index];
if (file.preview && index === 0) {
// if we have a canvas we had multiple uploaded files
if ($parent.find('canvas').length === 0) {
if (canvasPreview) {
var el = $(file.preview).css('width', '100%'); // .css('position', 'absolute').css('left', '0');
$parent.find('img').hide();
$parent.prepend(el);
if (index === 0) {
$parent.addClass("uploading");
$parent.find('.progress-bar').css('width', 0);
if (file.preview) {
// if we have a canvas we had multiple uploaded files
if ($parent.find('canvas').length === 0) {
if (canvasPreview) {
var el = $(file.preview).css('width', '100%'); // .css('position', 'absolute').css('left', '0');
$parent.find('img').hide();
$parent.prepend(el);
}
}
$parent.addClass("uploading");
$parent.find('.progress-bar').css('width', 0);
}
}
if (file.error) {
Expand Down

0 comments on commit 61ea565

Please sign in to comment.