@dmitryvim/form-builder 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form-builder.js +26 -6
- package/package.json +1 -1
package/dist/form-builder.js
CHANGED
|
@@ -564,9 +564,19 @@
|
|
|
564
564
|
}
|
|
565
565
|
|
|
566
566
|
for (const file of picker.files) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
567
|
+
try {
|
|
568
|
+
let resourceId;
|
|
569
|
+
if (config.uploadFile && typeof config.uploadFile === 'function') {
|
|
570
|
+
resourceId = await config.uploadFile(file);
|
|
571
|
+
} else {
|
|
572
|
+
resourceId = await makeResourceIdFromFile(file);
|
|
573
|
+
}
|
|
574
|
+
resourceIndex.set(resourceId, { name: file.name, type: file.type, size: file.size });
|
|
575
|
+
arr.push(resourceId);
|
|
576
|
+
} catch (error) {
|
|
577
|
+
markValidity(picker, `Upload failed: ${error.message}`);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
570
580
|
}
|
|
571
581
|
|
|
572
582
|
hid.value = JSON.stringify(arr);
|
|
@@ -690,9 +700,19 @@
|
|
|
690
700
|
}
|
|
691
701
|
}
|
|
692
702
|
for (const file of picker.files) {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
703
|
+
try {
|
|
704
|
+
let resourceId;
|
|
705
|
+
if (config.uploadFile && typeof config.uploadFile === 'function') {
|
|
706
|
+
resourceId = await config.uploadFile(file);
|
|
707
|
+
} else {
|
|
708
|
+
resourceId = await makeResourceIdFromFile(file);
|
|
709
|
+
}
|
|
710
|
+
resourceIndex.set(resourceId, { name: file.name, type: file.type, size: file.size });
|
|
711
|
+
arr.push(resourceId);
|
|
712
|
+
} catch (error) {
|
|
713
|
+
markValidity(picker, `Upload failed: ${error.message}`);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
696
716
|
}
|
|
697
717
|
hid.value = JSON.stringify(arr);
|
|
698
718
|
renderVideos(arr);
|