diff --git a/src/features/AdminPage/NewStreetcode/MainNewStreetcode.component.tsx b/src/features/AdminPage/NewStreetcode/MainNewStreetcode.component.tsx index 406d857b6..12a724a40 100644 --- a/src/features/AdminPage/NewStreetcode/MainNewStreetcode.component.tsx +++ b/src/features/AdminPage/NewStreetcode/MainNewStreetcode.component.tsx @@ -317,8 +317,13 @@ const NewStreetcode = () => { id: inputInfo?.id ?? 0, title: inputInfo?.title, textContent: inputInfo?.textContent ?? " ", - additionalText: inputInfo?.additionalText === '

Текст підготовлений спільно з

' - ? '' : inputInfo?.additionalText, + additionalText: + inputInfo?.textContent !== "


" + ? inputInfo?.additionalText === + "

Текст підготовлений спільно з

" + ? "" + : inputInfo?.additionalText + : "", streetcodeId: parseId, }; validateQuillTexts(text.textContent, text.additionalText); diff --git a/src/features/AdminPage/NewStreetcode/TextBlock/TextForm/AdditionTextBlock/AdditionalTextBlockAdminForm.component.tsx b/src/features/AdminPage/NewStreetcode/TextBlock/TextForm/AdditionTextBlock/AdditionalTextBlockAdminForm.component.tsx index f273718a0..b6346b743 100644 --- a/src/features/AdminPage/NewStreetcode/TextBlock/TextForm/AdditionTextBlock/AdditionalTextBlockAdminForm.component.tsx +++ b/src/features/AdminPage/NewStreetcode/TextBlock/TextForm/AdditionTextBlock/AdditionalTextBlockAdminForm.component.tsx @@ -2,7 +2,7 @@ /* eslint-disable react/jsx-props-no-multi-spaces */ import { observer } from 'mobx-react-lite'; -import { useRef } from 'react'; +import { useEffect, useRef, useState } from 'react'; import ReactQuill from 'react-quill'; import FormItem from 'antd/es/form/FormItem'; @@ -23,9 +23,20 @@ const AdditionalTextBlockAdminForm = ({ }: Props) => { const maxLength = character_limit || 200; const editorRef = useRef(null); + const [isTextContentEmpty, setIsTextContentEmpty] = useState(true); + const [isTitleEmpty, setIsTitleEmpty] = useState(true); + + useEffect(() => { + setIsTextContentEmpty(!inputInfo?.textContent || inputInfo.textContent === "


"); + }, [inputInfo?.textContent]); + + useEffect(() => { + setIsTitleEmpty(!inputInfo?.title || inputInfo.title === ""); + }, [inputInfo?.title]); return ( +
+
); };