This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch ai-ui
in repository https://gitbox.apache.org/repos/asf/answer.git

commit c6935608e6cd9594013c6521d73d8ae0c0fbba78
Author: shuai <[email protected]>
AuthorDate: Fri Jan 23 15:58:52 2026 +0800

    fix: Modifying the editor content overwrites other form content.
---
 ui/src/components/Modal/Modal.tsx           | 6 +++++-
 ui/src/pages/Questions/Ask/index.tsx        | 6 +++---
 ui/src/pages/Questions/EditAnswer/index.tsx | 8 ++++----
 ui/src/pages/Tags/Create/index.tsx          | 8 ++++----
 ui/src/pages/Tags/Edit/index.tsx            | 8 ++++----
 5 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/ui/src/components/Modal/Modal.tsx 
b/ui/src/components/Modal/Modal.tsx
index cbf98c24..580d51da 100644
--- a/ui/src/components/Modal/Modal.tsx
+++ b/ui/src/components/Modal/Modal.tsx
@@ -21,6 +21,8 @@ import React, { FC } from 'react';
 import { Button, Modal } from 'react-bootstrap';
 import { useTranslation } from 'react-i18next';
 
+import classNames from 'classnames';
+
 export interface Props {
   id?: string;
   /** header title */
@@ -77,7 +79,9 @@ const Index: FC<Props> = ({
           {title || t('title', { keyPrefix: 'modal_confirm' })}
         </Modal.Title>
       </Modal.Header>
-      <Modal.Body className={bodyClass}>{children}</Modal.Body>
+      <Modal.Body className={classNames('text-break', bodyClass)}>
+        {children}
+      </Modal.Body>
       {(showCancel || showConfirm) && (
         <Modal.Footer>
           {showCancel && (
diff --git a/ui/src/pages/Questions/Ask/index.tsx 
b/ui/src/pages/Questions/Ask/index.tsx
index 5fb4d57f..ab680c49 100644
--- a/ui/src/pages/Questions/Ask/index.tsx
+++ b/ui/src/pages/Questions/Ask/index.tsx
@@ -279,10 +279,10 @@ const Ask = () => {
     });
 
   const handleAnswerChange = (value: string) =>
-    setFormData({
-      ...formData,
+    setFormData((prev) => ({
+      ...prev,
       answer_content: { value, errorMsg: '', isInvalid: false },
-    });
+    }));
 
   const handleSummaryChange = (evt: React.ChangeEvent<HTMLInputElement>) =>
     setFormData({
diff --git a/ui/src/pages/Questions/EditAnswer/index.tsx 
b/ui/src/pages/Questions/EditAnswer/index.tsx
index 3be7befc..11b0411a 100644
--- a/ui/src/pages/Questions/EditAnswer/index.tsx
+++ b/ui/src/pages/Questions/EditAnswer/index.tsx
@@ -116,10 +116,10 @@ const Index = () => {
   }, [formData.content.value, formData.description.value]);
 
   const handleAnswerChange = (value: string) =>
-    setFormData({
-      ...formData,
-      content: { ...formData.content, value },
-    });
+    setFormData((prev) => ({
+      ...prev,
+      content: { ...prev.content, value },
+    }));
   const handleSummaryChange = (evt) => {
     const v = evt.currentTarget.value;
     setFormData({
diff --git a/ui/src/pages/Tags/Create/index.tsx 
b/ui/src/pages/Tags/Create/index.tsx
index b0564f19..428ba941 100644
--- a/ui/src/pages/Tags/Create/index.tsx
+++ b/ui/src/pages/Tags/Create/index.tsx
@@ -100,10 +100,10 @@ const Index = () => {
   ]);
 
   const handleDescriptionChange = (value: string) =>
-    setFormData({
-      ...formData,
-      description: { ...formData.description, value, isInvalid: false },
-    });
+    setFormData((prev) => ({
+      ...prev,
+      description: { value, isInvalid: false, errorMsg: '' },
+    }));
 
   const checkValidated = (): boolean => {
     let bol = true;
diff --git a/ui/src/pages/Tags/Edit/index.tsx b/ui/src/pages/Tags/Edit/index.tsx
index 0670b946..021ce1ce 100644
--- a/ui/src/pages/Tags/Edit/index.tsx
+++ b/ui/src/pages/Tags/Edit/index.tsx
@@ -117,10 +117,10 @@ const Index = () => {
   ]);
 
   const handleDescriptionChange = (value: string) =>
-    setFormData({
-      ...formData,
-      description: { ...formData.description, value },
-    });
+    setFormData((prev) => ({
+      ...prev,
+      description: { value, isInvalid: false, errorMsg: '' },
+    }));
 
   const checkValidated = (): boolean => {
     let bol = true;

Reply via email to