mirror of https://gitee.com/answerdev/answer.git
fix: #973
This commit is contained in:
parent
d8354224d4
commit
9868cf498d
|
@ -3,6 +3,7 @@ import { Form, Button } from 'react-bootstrap';
|
|||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { marked } from 'marked';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { Editor, Modal } from '@answer/components';
|
||||
import { postAnswer } from '@answer/api';
|
||||
|
@ -30,6 +31,7 @@ const Index: FC<Props> = ({ visible = false, data, callback }) => {
|
|||
},
|
||||
});
|
||||
const [showEditor, setShowEditor] = useState<boolean>(visible);
|
||||
const [focusType, setForceType] = useState('');
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (!formData.content.value) {
|
||||
|
@ -92,6 +94,10 @@ const Index: FC<Props> = ({ visible = false, data, callback }) => {
|
|||
className="d-none"
|
||||
/>
|
||||
<Editor
|
||||
className={classNames(
|
||||
'form-control p-0',
|
||||
focusType === 'answer' && 'focus',
|
||||
)}
|
||||
value={formData.content.value}
|
||||
onChange={(val) => {
|
||||
setFormData({
|
||||
|
@ -102,6 +108,12 @@ const Index: FC<Props> = ({ visible = false, data, callback }) => {
|
|||
},
|
||||
});
|
||||
}}
|
||||
onFocus={() => {
|
||||
setForceType('answer');
|
||||
}}
|
||||
onBlur={() => {
|
||||
setForceType('');
|
||||
}}
|
||||
/>
|
||||
|
||||
<Form.Control.Feedback type="invalid">
|
||||
|
|
Loading…
Reference in New Issue