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: create new tag set default value

shuai3f6253e3c28f
diff --git a/ui/src/components/TagSelector/index.tsx b/ui/src/components/TagSelector/index.tsx
index c54329b4..504134c3 100644
--- a/ui/src/components/TagSelector/index.tsx
+++ b/ui/src/components/TagSelector/index.tsx
@@ -253,7 +253,7 @@ const TagSelector: FC<IProps> = ({
variant="link"
className="px-3 btn-no-border w-100 text-start"
onClick={() => {
- tagModal.onShow();
+ tagModal.onShow(tag);
}}>
+ {t('create_btn')}
</Button>
diff --git a/ui/src/hooks/useTagModal/index.tsx b/ui/src/hooks/useTagModal/index.tsx
index 99ea8b56..4a24870a 100644
--- a/ui/src/hooks/useTagModal/index.tsx
+++ b/ui/src/hooks/useTagModal/index.tsx
@@ -39,8 +39,21 @@ const useTagModal = (props: IProps = {}) => {
setVisibleState(false);
};
- const onShow = () => {
+ const onShow = (searchStr = '') => {
setVisibleState(true);
+ setFormData({
+ ...formData,
+ displayName: {
+ value: searchStr,
+ isInvalid: false,
+ errorMsg: '',
+ },
+ slugName: {
+ value: searchStr,
+ isInvalid: false,
+ errorMsg: '',
+ },
+ });
};
const checkValidated = (): boolean => {