mirror of https://gitee.com/answerdev/answer.git
Merge branch 'feat/ui-1.0.4' into 'test'
Feat/ui 1.0.4 See merge request opensource/answer!431
This commit is contained in:
commit
7a57cb5543
|
@ -510,6 +510,8 @@ ui:
|
|||
label: Revision
|
||||
answer:
|
||||
label: Answer
|
||||
feedback:
|
||||
characters: content must be at least 6 characters in length.
|
||||
edit_summary:
|
||||
label: Edit Summary
|
||||
placeholder: >-
|
||||
|
@ -774,6 +776,7 @@ ui:
|
|||
<p>Are you sure you want to add another answer?</p><p>You could use the
|
||||
edit link to refine and improve your existing answer, instead.</p>
|
||||
empty: Answer cannot be empty.
|
||||
characters: content must be at least 6 characters in length.
|
||||
reopen:
|
||||
title: Reopen this post
|
||||
content: Are you sure you want to reopen?
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useState, useEffect, useRef } from 'react';
|
||||
import React, { useState, useRef } from 'react';
|
||||
import { Container, Row, Col, Form, Button, Card } from 'react-bootstrap';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
@ -36,7 +36,6 @@ const initFormData = {
|
|||
},
|
||||
};
|
||||
const Index = () => {
|
||||
const [formData, setFormData] = useState<FormDataItem>(initFormData);
|
||||
const { aid = '', qid = '' } = useParams();
|
||||
const [focusType, setForceType] = useState('');
|
||||
|
||||
|
@ -44,6 +43,10 @@ const Index = () => {
|
|||
const navigate = useNavigate();
|
||||
|
||||
const { data } = useQueryAnswerInfo(aid);
|
||||
const [formData, setFormData] = useState<FormDataItem>(initFormData);
|
||||
|
||||
initFormData.content.value = data?.info.content || '';
|
||||
|
||||
const { data: revisions = [] } = useQueryRevisions(aid);
|
||||
|
||||
const editorRef = useRef<EditorRef>({
|
||||
|
@ -52,14 +55,6 @@ const Index = () => {
|
|||
|
||||
const questionContentRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
formData.content.value = data.info.content;
|
||||
setFormData({ ...formData });
|
||||
}, [data]);
|
||||
|
||||
const handleAnswerChange = (value: string) =>
|
||||
setFormData({
|
||||
...formData,
|
||||
|
@ -145,6 +140,8 @@ const Index = () => {
|
|||
usePageTags({
|
||||
title: t('edit_answer', { keyPrefix: 'page_title' }),
|
||||
});
|
||||
|
||||
console.log('formData.content.value', formData.content.value);
|
||||
return (
|
||||
<Container className="pt-4 mt-2 mb-5 edit-answer-wrap">
|
||||
<Row className="justify-content-center">
|
||||
|
|
Loading…
Reference in New Issue