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(EditAnswer): Resets the scroll position of the `EditAnswer` page to the top on each visit
haitaoo6a89c9be5f68
diff --git a/ui/src/pages/Questions/EditAnswer/index.tsx b/ui/src/pages/Questions/EditAnswer/index.tsxindex 5c8e9798..6fca48d3 100644--- a/ui/src/pages/Questions/EditAnswer/index.tsx+++ b/ui/src/pages/Questions/EditAnswer/index.tsx@@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';import dayjs from 'dayjs';import classNames from 'classnames';-import { handleFormError } from '@/utils';+import { handleFormError, scrollToDocTop } from '@/utils';import { usePageTags, usePromptWithUnload } from '@/hooks';import { pathFactory } from '@/router/pathFactory';import { Editor, EditorRef, Icon } from '@/components';@@ -27,6 +27,9 @@ interface FormDataItem {const Index = () => {const { aid = '', qid = '' } = useParams();const [focusType, setForceType] = useState('');+ useLayoutEffect(() => {+ scrollToDocTop();+ }, []);const { t } = useTranslation('translation', { keyPrefix: 'edit_answer' });const navigate = useNavigate();