@dmitryvim/form-builder 0.1.20 → 0.1.22
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 +7 -2
- package/package.json +1 -1
package/dist/form-builder.js
CHANGED
|
@@ -230,7 +230,7 @@ function renderElement(element, ctx) {
|
|
|
230
230
|
size: 0,
|
|
231
231
|
file: null // No local file for prefill data
|
|
232
232
|
});
|
|
233
|
-
|
|
233
|
+
|
|
234
234
|
}
|
|
235
235
|
renderFilePreview(fileContainer, initial, initial, '', false).catch(console.error);
|
|
236
236
|
} else {
|
|
@@ -339,7 +339,7 @@ function renderElement(element, ctx) {
|
|
|
339
339
|
size: 0,
|
|
340
340
|
file: null // No local file for prefill data
|
|
341
341
|
});
|
|
342
|
-
|
|
342
|
+
|
|
343
343
|
}
|
|
344
344
|
});
|
|
345
345
|
}
|
|
@@ -581,6 +581,7 @@ function makeFieldHint(element) {
|
|
|
581
581
|
}
|
|
582
582
|
|
|
583
583
|
async function renderFilePreview(container, resourceId, fileName, fileType, isReadonly = false) {
|
|
584
|
+
|
|
584
585
|
// Don't change container className - preserve max-w-xs and other styling
|
|
585
586
|
|
|
586
587
|
// Clear container content first
|
|
@@ -596,7 +597,9 @@ async function renderFilePreview(container, resourceId, fileName, fileType, isRe
|
|
|
596
597
|
|
|
597
598
|
// Use stored file from resourceIndex if available, or try getThumbnail
|
|
598
599
|
const meta = state.resourceIndex.get(resourceId);
|
|
600
|
+
|
|
599
601
|
if (meta && meta.file && meta.file instanceof File) {
|
|
602
|
+
|
|
600
603
|
// For local files, use FileReader to display preview
|
|
601
604
|
if (meta.type && meta.type.startsWith('image/')) {
|
|
602
605
|
const reader = new FileReader();
|
|
@@ -632,9 +635,11 @@ async function renderFilePreview(container, resourceId, fileName, fileType, isRe
|
|
|
632
635
|
});
|
|
633
636
|
}
|
|
634
637
|
} else if (state.config.getThumbnail) {
|
|
638
|
+
|
|
635
639
|
// Try to get thumbnail from config for uploaded files
|
|
636
640
|
try {
|
|
637
641
|
const thumbnailUrl = await state.config.getThumbnail(resourceId);
|
|
642
|
+
|
|
638
643
|
if (thumbnailUrl) {
|
|
639
644
|
img.src = thumbnailUrl;
|
|
640
645
|
container.appendChild(img);
|