Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: #973

robin9868cf498d97
diff --git a/ui/src/pages/Questions/Detail/components/WriteAnswer/index.tsx b/ui/src/pages/Questions/Detail/components/WriteAnswer/index.tsx
index afba9e42..6343f7ef 100644
--- a/ui/src/pages/Questions/Detail/components/WriteAnswer/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/WriteAnswer/index.tsx
@@ -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">