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: editor autofoucs state error

shuaif5f9958627ea
diff --git a/ui/src/pages/Questions/Detail/components/WriteAnswer/index.tsx b/ui/src/pages/Questions/Detail/components/WriteAnswer/index.tsx
index 01badd47..5f96b422 100644
--- a/ui/src/pages/Questions/Detail/components/WriteAnswer/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/WriteAnswer/index.tsx
@@ -32,6 +32,7 @@ const Index: FC<Props> = ({ visible = false, data, callback }) => {
});
const [showEditor, setShowEditor] = useState<boolean>(visible);
const [focusType, setForceType] = useState('');
+ const [editorFoucsState, setEditorFoucsState] = useState(false);
const handleSubmit = () => {
if (!formData.content.value) {
@@ -84,6 +85,7 @@ const Index: FC<Props> = ({ visible = false, data, callback }) => {
const handleFocusForTextArea = () => {
setForceType('answer');
setShowEditor(true);
+ setEditorFoucsState(true);
};
return (
@@ -114,7 +116,7 @@ const Index: FC<Props> = ({ visible = false, data, callback }) => {
focusType === 'answer' && 'focus',
)}
value={formData.content.value}
- autoFocus
+ autoFocus={editorFoucsState}
onChange={(val) => {
setFormData({
content: {