Skip to content

Commit b281141

Browse files
committed
solve multiple images issues
1 parent 4c373aa commit b281141

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

dist/components/inputs/textInput/components/TextInput.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/web.umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/inputs/textInput/components/TextInput.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,14 @@ export const TextInput = (props: TextInputProps) => {
108108
) {
109109
e.preventDefault();
110110
const dataTransfer = new DataTransfer();
111-
imageFiles.forEach((file) => dataTransfer.items.add(file));
111+
const timestamp = Date.now();
112+
imageFiles.forEach((file, index) => {
113+
const ext = file.name.split('.').pop() || 'png';
114+
const baseName = file.name.replace(/\.[^/.]+$/, '');
115+
const uniqueName = `${baseName}_${timestamp}_${index}.${ext}`;
116+
const renamedFile = new File([file], uniqueName, { type: file.type });
117+
dataTransfer.items.add(renamedFile);
118+
});
112119
const syntheticEvent = { target: { files: dataTransfer.files } } as FileEvent<HTMLInputElement>;
113120
props.handleFileChange(syntheticEvent);
114121
}

0 commit comments

Comments
 (0)