You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by sh...@apache.org on 2024/07/18 09:38:20 UTC
(incubator-answer) branch test updated (0c98e0c3 -> 6c091510)
This is an automated email from the ASF dual-hosted git repository.
shuai pushed a change to branch test
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
from 0c98e0c3 Merge branch 'feat/1.3.6/cmd' into test
new 83a8e9eb fix: tagSelector show all recommended tags
new eba1d4d8 fix: use ScrollRestoration component control page position
new 6c091510 Merge branch 'test' of github.com:answerdev/answer into test
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
ui/src/components/Pagination/index.tsx | 5 +----
ui/src/components/TagSelector/index.scss | 2 ++
ui/src/components/TagSelector/index.tsx | 4 ++--
ui/src/pages/Layout/index.tsx | 3 ++-
ui/src/pages/Questions/Detail/index.tsx | 1 -
ui/src/pages/Questions/EditAnswer/index.tsx | 7 ++-----
ui/src/pages/Tags/Detail/index.tsx | 8 +-------
7 files changed, 10 insertions(+), 20 deletions(-)
(incubator-answer) 03/03: Merge branch 'test' of github.com:answerdev/answer into test
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 6c0915107efc730a1f868d1d1dbd7b9df2aa6ae2
Merge: eba1d4d8 0c98e0c3
Author: shuai <li...@sifou.com>
AuthorDate: Thu Jul 18 17:37:39 2024 +0800
Merge branch 'test' of github.com:answerdev/answer into test
cmd/command.go | 32 +++++++++-
internal/cli/i18n.go | 158 ++++++++++++++++++++++++++++++++++++++++++++++++
internal/cli/install.go | 20 +++---
3 files changed, 201 insertions(+), 9 deletions(-)
(incubator-answer) 01/03: fix: tagSelector show all recommended tags
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 83a8e9eb0926de1e345661c72dc0a629c431d735
Author: shuai <li...@sifou.com>
AuthorDate: Thu Jul 18 16:10:19 2024 +0800
fix: tagSelector show all recommended tags
---
ui/src/components/TagSelector/index.scss | 2 ++
ui/src/components/TagSelector/index.tsx | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ui/src/components/TagSelector/index.scss b/ui/src/components/TagSelector/index.scss
index 5d26102e..7cbeb5a8 100644
--- a/ui/src/components/TagSelector/index.scss
+++ b/ui/src/components/TagSelector/index.scss
@@ -20,6 +20,8 @@
.tag-selector-wrap {
.dropdown-menu {
min-width: 15rem;
+ max-height: 178px;
+ overflow-y: auto;
}
.dropdown-toggle {
&::after {
diff --git a/ui/src/components/TagSelector/index.tsx b/ui/src/components/TagSelector/index.tsx
index 1204a686..2e539a05 100644
--- a/ui/src/components/TagSelector/index.tsx
+++ b/ui/src/components/TagSelector/index.tsx
@@ -154,10 +154,10 @@ const TagSelector: FC<IProps> = ({
queryTags(str).then((res) => {
const tagArray: Type.Tag[] = filterTags(res || []);
if (str === '') {
- setRequiredTags(res?.length > 5 ? res.slice(0, 5) : res);
+ setRequiredTags(res);
}
handleMenuShow(tagArray.length > 0);
- setTags(tagArray?.length > 5 ? tagArray.slice(0, 5) : tagArray);
+ setTags(tagArray);
});
};
(incubator-answer) 02/03: fix: use ScrollRestoration component control page position
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit eba1d4d8d61d99d92dad5f3de357b79dd9aa793d
Author: shuai <li...@sifou.com>
AuthorDate: Thu Jul 18 17:37:19 2024 +0800
fix: use ScrollRestoration component control page position
---
ui/src/components/Pagination/index.tsx | 5 +----
ui/src/pages/Layout/index.tsx | 3 ++-
ui/src/pages/Questions/Detail/index.tsx | 1 -
ui/src/pages/Questions/EditAnswer/index.tsx | 7 ++-----
ui/src/pages/Tags/Detail/index.tsx | 8 +-------
5 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/ui/src/components/Pagination/index.tsx b/ui/src/components/Pagination/index.tsx
index ab5dc403..69d113eb 100644
--- a/ui/src/components/Pagination/index.tsx
+++ b/ui/src/components/Pagination/index.tsx
@@ -22,7 +22,7 @@ import { Pagination } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { useSearchParams, useNavigate, useLocation } from 'react-router-dom';
-import { scrollToDocTop, floppyNavigation } from '@/utils';
+import { floppyNavigation } from '@/utils';
interface Props {
currentPage: number;
@@ -71,7 +71,6 @@ const PageItem = ({ page, currentPage, path }: PageItemProps) => {
e.preventDefault();
e.stopPropagation();
navigate(path);
- scrollToDocTop();
}
}}>
{page}
@@ -115,7 +114,6 @@ const Index: FC<Props> = ({
if (floppyNavigation.shouldProcessLinkClick(e)) {
e.preventDefault();
navigate(handleParams(currentPage - 1));
- scrollToDocTop();
}
}}>
{t('prev')}
@@ -212,7 +210,6 @@ const Index: FC<Props> = ({
if (floppyNavigation.shouldProcessLinkClick(e)) {
e.preventDefault();
navigate(handleParams(currentPage + 1));
- scrollToDocTop();
}
}}>
{t('next')}
diff --git a/ui/src/pages/Layout/index.tsx b/ui/src/pages/Layout/index.tsx
index cf7a2f1b..2029b0fa 100644
--- a/ui/src/pages/Layout/index.tsx
+++ b/ui/src/pages/Layout/index.tsx
@@ -18,7 +18,7 @@
*/
import { FC, memo, useEffect } from 'react';
-import { Outlet, useLocation } from 'react-router-dom';
+import { Outlet, useLocation, ScrollRestoration } from 'react-router-dom';
import { HelmetProvider } from 'react-helmet-async';
import { SWRConfig } from 'swr';
@@ -86,6 +86,7 @@ const Layout: FC = () => {
<Footer />
<Customize />
<LoginToContinueModal visible={showLoginToContinueModal} />
+ <ScrollRestoration />
</SWRConfig>
</HelmetProvider>
);
diff --git a/ui/src/pages/Questions/Detail/index.tsx b/ui/src/pages/Questions/Detail/index.tsx
index 2130ddf7..0ab02514 100644
--- a/ui/src/pages/Questions/Detail/index.tsx
+++ b/ui/src/pages/Questions/Detail/index.tsx
@@ -214,7 +214,6 @@ const Index = () => {
if (!qid) {
return;
}
- scrollToDocTop();
getDetail();
requestAnswers();
}, [qid]);
diff --git a/ui/src/pages/Questions/EditAnswer/index.tsx b/ui/src/pages/Questions/EditAnswer/index.tsx
index 9ca6f413..831aa5a2 100644
--- a/ui/src/pages/Questions/EditAnswer/index.tsx
+++ b/ui/src/pages/Questions/EditAnswer/index.tsx
@@ -17,7 +17,7 @@
* under the License.
*/
-import React, { useState, useRef, useEffect, useLayoutEffect } from 'react';
+import React, { useState, useRef, useEffect } from 'react';
import { Row, Col, Form, Button, Card } from 'react-bootstrap';
import { useParams, useNavigate, Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
@@ -25,7 +25,7 @@ import { useTranslation } from 'react-i18next';
import dayjs from 'dayjs';
import classNames from 'classnames';
-import { handleFormError, scrollToDocTop } from '@/utils';
+import { handleFormError } from '@/utils';
import { usePageTags, usePromptWithUnload } from '@/hooks';
import { useCaptchaPlugin, useRenderHtmlPlugin } from '@/utils/pluginKit';
import { pathFactory } from '@/router/pathFactory';
@@ -47,9 +47,6 @@ interface FormDataItem {
const Index = () => {
const { aid = '', qid = '' } = useParams();
const [focusType, setForceType] = useState('');
- useLayoutEffect(() => {
- scrollToDocTop();
- }, []);
const { t } = useTranslation('translation', { keyPrefix: 'edit_answer' });
const navigate = useNavigate();
diff --git a/ui/src/pages/Tags/Detail/index.tsx b/ui/src/pages/Tags/Detail/index.tsx
index a07236da..42b89d5d 100644
--- a/ui/src/pages/Tags/Detail/index.tsx
+++ b/ui/src/pages/Tags/Detail/index.tsx
@@ -38,7 +38,7 @@ import {
} from '@/services';
import QuestionList, { QUESTION_ORDER_KEYS } from '@/components/QuestionList';
import HotQuestions from '@/components/HotQuestions';
-import { escapeRemove, guard, scrollToDocTop } from '@/utils';
+import { escapeRemove, guard } from '@/utils';
import { pathFactory } from '@/router/pathFactory';
const Index: FC = () => {
@@ -75,12 +75,6 @@ const Index: FC = () => {
});
};
- useEffect(() => {
- if (!listLoading) {
- scrollToDocTop();
- }
- }, [listLoading]);
-
useEffect(() => {
if (tagResp) {
const info = { ...tagResp };