From fe0d877f5a08c33567d9ef66c8cbb2434802462f Mon Sep 17 00:00:00 2001 From: yayunhuang Date: Thu, 22 Aug 2024 14:44:42 +0800 Subject: [PATCH] Fix preview icon was not selected when uploading only one image --- public/scripts/upload.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/scripts/upload.js b/public/scripts/upload.js index 28e47a5..d70ad3d 100644 --- a/public/scripts/upload.js +++ b/public/scripts/upload.js @@ -164,15 +164,15 @@ class FileListViewModel { await imageUpload.read(); imageUpload.ulid = ULID.ulid(); + if (window.viewModel.selectedPreviewImageULID === null && i === 0) { + window.viewModel.selectedPreviewImageULID = imageUpload.ulid; + } // Avoiding read same image file setTimeout(() => { this._imageUploads.push(imageUpload); window.viewModel.generatePreviewMockup(imageUpload); }, i * 10); } - - window.viewModel.selectedPreviewImageULID = - window.viewModel.defaultImageUploadULID; } async remove(filename, fileUlid) {