From f274070c60815979bff04b187e1d81c7db93c84a Mon Sep 17 00:00:00 2001 From: Nastya Date: Sun, 22 Jun 2025 18:27:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BA=D1=80=D0=B5=D1=81=D1=82=D0=B8=D0=BA=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BA=D0=B0=D0=B7=D1=8B=D0=B2=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=D1=81=D1=8F=20=D0=B2=20Images=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA?= =?UTF-8?q?=D0=BE=20=D0=BA=D0=BE=D0=B3=D0=B4=D0=B0=20=D0=B7=D0=B0=D0=B3?= =?UTF-8?q?=D1=80=D1=83=D0=B6=D0=B5=D0=BD=D0=B0=20=D0=BA=D0=B0=D1=80=D1=82?= =?UTF-8?q?=D0=B8=D0=BD=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewPublicationPage/questions/Images/OwnImage.tsx | 9 ++++++++- lib/stores/quizView.ts | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/components/ViewPublicationPage/questions/Images/OwnImage.tsx b/lib/components/ViewPublicationPage/questions/Images/OwnImage.tsx index 7018e47..9307ee7 100644 --- a/lib/components/ViewPublicationPage/questions/Images/OwnImage.tsx +++ b/lib/components/ViewPublicationPage/questions/Images/OwnImage.tsx @@ -85,7 +85,13 @@ export const OwnImage = ({ imageUrl, questionId, variantId, onValidationError }: const handleRemoveImage = (e: React.MouseEvent) => { e.stopPropagation(); setSelectedFile(null); - updateOwnVariant(variantId, "", "", "", ""); + updateOwnVariant(variantId, ownVariantData?.variant.answer || "", "", "", ""); + /* + 1 - answer - письменный ответ + 2 - extendedText - строка используется в эмодзи-вопросах для хранения выбранного эмодзи + 3 - originalImageUrl - полный URL изображения, загруженного на сервер + 4 - localImageUrl - временный URL для отображения изображения в браузере + */ }; // Определяем, что показывать @@ -152,6 +158,7 @@ export const OwnImage = ({ imageUrl, questionId, variantId, onValidationError }: color: "white", height: "25px", width: "25px", + display: selectedFile ? "inherit" : "none", "&:hover": { backgroundColor: "rgba(0, 0, 0, 0.7)", }, diff --git a/lib/stores/quizView.ts b/lib/stores/quizView.ts index 3238ce5..826cf03 100644 --- a/lib/stores/quizView.ts +++ b/lib/stores/quizView.ts @@ -115,13 +115,13 @@ export const createQuizViewStore = () => }); } else { state.ownVariants[index].variant.answer = answer; - if (extendedText) { + if (extendedText !== undefined) { state.ownVariants[index].variant.extendedText = extendedText; } - if (originalImageUrl) { + if (originalImageUrl !== undefined) { state.ownVariants[index].variant.originalImageUrl = originalImageUrl; } - if (localImageUrl) { + if (localImageUrl !== undefined) { state.ownVariants[index].variant.localImageUrl = localImageUrl; } }