@dmitryvim/form-builder 0.1.21 → 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 -6
- 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,9 +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);
|
|
599
|
-
|
|
600
|
+
|
|
600
601
|
if (meta && meta.file && meta.file instanceof File) {
|
|
601
|
-
|
|
602
|
+
|
|
602
603
|
// For local files, use FileReader to display preview
|
|
603
604
|
if (meta.type && meta.type.startsWith('image/')) {
|
|
604
605
|
const reader = new FileReader();
|
|
@@ -634,11 +635,11 @@ async function renderFilePreview(container, resourceId, fileName, fileType, isRe
|
|
|
634
635
|
});
|
|
635
636
|
}
|
|
636
637
|
} else if (state.config.getThumbnail) {
|
|
637
|
-
|
|
638
|
+
|
|
638
639
|
// Try to get thumbnail from config for uploaded files
|
|
639
640
|
try {
|
|
640
641
|
const thumbnailUrl = await state.config.getThumbnail(resourceId);
|
|
641
|
-
|
|
642
|
+
|
|
642
643
|
if (thumbnailUrl) {
|
|
643
644
|
img.src = thumbnailUrl;
|
|
644
645
|
container.appendChild(img);
|